Hello -
I'm interested in finding out whether it's possible to combine CSS positioning with tables in the same page layout.
The reason: So far my designs using CSS to position the elements hug the left-side of the browser window - I design for 800x600, 15" monitor. How can I get the entire page to center in the window of a larger monitor? Can I set variable widths in CSS to achieve this?
When I used to lay out the page using tables, the page would adapt to fit the monitor size.
Any and all feedback welcome.
- Robsta
If you specify a valid doctype (see <!-- m --><a class="postlink" href="http://www.webdevfaqs.com/html.php#doctype">http://www.webdevfaqs.com/html.php#doctype</a><!-- m --> for more info) you can use <div style="width: 300px; margin: auto;"> to center a div on your page. If you don't specify a doctype, IE will go into quirks mode, and will not correctly handle margin: auto;Yes you can. Your question is too general to elicit a better answer. There are several ways how you can accomplish that. One of them is:
body {width: 800px; margin:0 auto}
Other option is not to specify any width and let the page adjust to user-defined width.
Third option is to position the elements left: 50% and give them negative margin (margin-left: -400px}.
HTH
NiketThanks for the feedback - all this is a little beyond me, so it may take a while before I can give you any follow-up. I got some learnin' to do.
Thanks again,
Robsta
:rolleyes
I'm interested in finding out whether it's possible to combine CSS positioning with tables in the same page layout.
The reason: So far my designs using CSS to position the elements hug the left-side of the browser window - I design for 800x600, 15" monitor. How can I get the entire page to center in the window of a larger monitor? Can I set variable widths in CSS to achieve this?
When I used to lay out the page using tables, the page would adapt to fit the monitor size.
Any and all feedback welcome.
- Robsta
If you specify a valid doctype (see <!-- m --><a class="postlink" href="http://www.webdevfaqs.com/html.php#doctype">http://www.webdevfaqs.com/html.php#doctype</a><!-- m --> for more info) you can use <div style="width: 300px; margin: auto;"> to center a div on your page. If you don't specify a doctype, IE will go into quirks mode, and will not correctly handle margin: auto;Yes you can. Your question is too general to elicit a better answer. There are several ways how you can accomplish that. One of them is:
body {width: 800px; margin:0 auto}
Other option is not to specify any width and let the page adjust to user-defined width.
Third option is to position the elements left: 50% and give them negative margin (margin-left: -400px}.
HTH
NiketThanks for the feedback - all this is a little beyond me, so it may take a while before I can give you any follow-up. I got some learnin' to do.
Thanks again,
Robsta
:rolleyes