Sunny Posted February 25, 2006 Share Posted February 25, 2006 Please help me with this :I have used 'div' to format my page and use <center> to make sure the page body is in the middle. The problem I have is that if my page is long and a scrollbar is displayed and therefore the page is wider. But if the page is short (therefore no scrollbar) the page is one scrollbar narrower. So when I jump between the 2 pages, the displayed page is jumping left and right. Are there a CSS property I can use to make sure the scrollbar always display for the body of my page ? Or are there any other way I can stop the shifting. Thank you in advance. Link to comment Share on other sites More sharing options...
newbman Posted February 25, 2006 Share Posted February 25, 2006 I hardly have a clue about what you are saying, but...You are talking about horizontal scrollbar right?First of all, the <center> tag is depreciated by W3C.So, I would get rid of the center tag and use styles instead.Set the div width fixed and center it by doing this in styles:div{width: 800px;margin: auto}Is that what you wanted? Link to comment Share on other sites More sharing options...
Sunny Posted February 25, 2006 Author Share Posted February 25, 2006 The problem is the vertical scrollbar changing the width of the page. Meanwhile I will use CSS to center the page. Link to comment Share on other sites More sharing options...
newbman Posted February 25, 2006 Share Posted February 25, 2006 Could you give a link to the site? Cause I don't know exactly what you mean. Link to comment Share on other sites More sharing options...
Sunny Posted February 25, 2006 Author Share Posted February 25, 2006 the site is www.toplanaholiday.com Link to comment Share on other sites More sharing options...
newbman Posted February 26, 2006 Share Posted February 26, 2006 OIC what you mean.The nonscrolling pages are not perfectly centered. I could not find exactly how to fix the problem, but I realised that you have a lot of nonstandard coding. That could be the reason the content isn't perfectly centered.e.g. the <center> is outside the <body> tags, plus it's depreciatedi skimmed through your code and found several other instances Link to comment Share on other sites More sharing options...
Sunny Posted February 26, 2006 Author Share Posted February 26, 2006 I have been looking but still not sure how to code the css to center the page. Can you help ?Also I think if I can put a scrollbar on all pages, the problem will be solved. But I am not sure how to code this either. Any help will be appreciated. Link to comment Share on other sites More sharing options...
newbman Posted February 26, 2006 Share Posted February 26, 2006 I went to your website again and see you have fixed the problem by extending theheight of the div and you've used styles to center the content.Here's some other bugs you might want to fix:you can't use styles on htmlbefore a:hover you have to have a:link and a:visitedyou should change #fff to #ffffff and #000 to #000000#header p should be p#headertext-color should just be colorbackground: #fff should be background-color:#ffffffThat should clean it up! I don't think half of the above will make a difference, but it's proper coding. Try validating your code. Link to comment Share on other sites More sharing options...
Sunny Posted February 26, 2006 Author Share Posted February 26, 2006 Thanks very much for your help. I have made further changes to tidy up my code. It was good you have spotted the #header p. I meant it to be #header, p. That solved the problems I have been trying to solve all morning. Two more questions if I may:1) How did you see my CSS from the website ? I thought you can only view the HTML source code behind the page. 2) I have tried to use Dreamweaver to fix the code but it makes the code worse, I think. What are the other ways I can validate the code ?Thanks again. Link to comment Share on other sites More sharing options...
newbman Posted February 26, 2006 Share Posted February 26, 2006 To get find your css file, I looked at your source.It said <link rel=... href="style2.css">So I typed in www.toplanavacation.com/style2.css in the address barTo validate your code click here Link to comment Share on other sites More sharing options...
Sunny Posted March 1, 2006 Author Share Posted March 1, 2006 Hi Newbman,I have just tried to validate www.toplanaholiday.com and have got a lot of errors. The errors are mainly the stuff I copied from the Net. The validator complaint about this line:<meta name="description" content="my contents" /> until I changed it to <meta name="description" content="my content"> but most websites have it the incorrect way !!The DOCTYPE is "HTML 4.01 Transitional", should I be using anything else ? I am quite confused about what it all means and how important that isSome lines flagged as error are inserted by the server (SSI include). How should one get rid of this types of errors ? Link to comment Share on other sites More sharing options...
lugos Posted March 1, 2006 Share Posted March 1, 2006 Hi Newbman,I have just tried to validate www.toplanaholiday.com and have got a lot of errors. The errors are mainly the stuff I copied from the Net. The validator complaint about this line:<meta name="description" content="my contents" /> until I changed it to <meta name="description" content="my content"> but most websites have it the incorrect way !!The DOCTYPE is "HTML 4.01 Transitional", should I be using anything else ? I am quite confused about what it all means and how important that isSome lines flagged as error are inserted by the server (SSI include). How should one get rid of this types of errors ?<{POST_SNAPBACK}> The reason why you're meta tag generated an error is because you are using DOCTYPE HTML 4.01 Transitional. You probably want to be using <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> instead. Link to comment Share on other sites More sharing options...
Sunny Posted March 1, 2006 Author Share Posted March 1, 2006 I have tried that just now, still got 12 errors on the meta tag stuff. Link to comment Share on other sites More sharing options...
newbman Posted March 3, 2006 Share Posted March 3, 2006 There are still html 4.01 transitional tags, and they aren't even allowed. You should try making your html document one instead of many.Also, the meta tags don't have /> Link to comment Share on other sites More sharing options...
Sunny Posted March 8, 2006 Author Share Posted March 8, 2006 I am a bit confused. I referred to the xhtml tutorial meta tag and it seems the meta tags do have '/' at the end. Am I missing something here?I can see from the page source, the server inserted 'HTML' document everytime I use the SSI include . In my original code, I only have one 'HTML' document. Anything I can do to control what the server inserts in my page ?Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now