basic HTML question?

I was just wondering how Yahoo answers keep the content of this website in the center of the page and how the background (gray strips) don't go into the center of the page. Do they use a table with only one cell to separate the background from the rest of the page?

Public Comments

  1. The content area is a div with margin:opx auto; which centers it on the page. The gray background is just a tiled background image set on the body tag.
  2. It isn't just html. There are scripting languages that exist now. You can obtain traits of the browser like how big the browser window is and position the frames accordingly. You do not get to see the script since mostly it is server side. Right click on the screen and click view source to get a better picture of this. Wait the guy above me is right. However, there is more than one way to do it.
  3. Always use DIV tags if you can, tables are not flexible and are meant for data output really. Yahoo answers just has the image repeating for the background of the body of the html page. Then they just within the <body> create the center piece a <div> tag. They then center that div and make it's background whatever color they want, in this case white, on the page with CSS The CSS for the body tag is (observe the image background and the text-align center) body {k-search-2.1.373.... (line 914) background:transparent url(http://us.i1.yimg.com/us.yimg.com/i/us/sch/gr/bggreydiag.gif) repeat scroll 0%; margin:0px 4px; padding:0pt; text-align:center; }
  4. The answer is in the CSS they used http://l.yimg.com/static.answers.yahoo.com/00208/css/answers-fe-us.css (if you're using firefox) http://l.yimg.com/static.answers.yahoo.com/00208/css/answers-ie-us.css (if you're using IE)
Powered by Yahoo! Answers