How do I vertically align a CSS styled page in Dreamweaver?
VallieValVal
2011-08-15 21:49:01 UTC
I have managed to horizontally align my page, however how to I vertically align it so that it is aligned in the middle of the browser?
I'm using CSS and not tables, so please no answers re: tables.
Help would be much appreciated! Thanks
Three answers:
2011-08-16 09:27:46 UTC
Aligning - Dead Center of page: http://pastebin.com/p7phM4wA
Centering an element requires setting a width to the exact width of the content and using the CSS property: margin: 0 auto; This is done in the CSS that styles the element. Example:
body {
width: 90%;
height: 600px; /* optional */
margin: 0 auto;
background: #fff url(path to non-tiled image) no-repeat center scroll;
}
Example as a Class:
.selector_name {
width: 90%;
height: 600px; /* optional */
margin: 0 auto;
background: #fff url(path to non-tiled image) no-repeat center scroll;
}
HTML for Class:
Content here
Example as an ID:
#selector_name {
width: 90%;
height: 600px; /* optional */
margin: 0 auto;
background: #fff url(path to non-tiled image) no-repeat center scroll;
}
HTML for Class:
Content here
Change parameters as you need. Set "#fff" to background color you want. Set "scroll" to "fixed" if you want page contents to scroll over background image. CSS was given for an image that does not tile. Doesn't have to be the body tag, but you should get the idea.
Ron
2016-12-02 00:25:40 UTC
Is it exhibiting your internet site inproperly or on no account? as a results of fact, Dreamweaver CS3 does no longer completely help CSS, and each so often does no longer help it wisely. The layout view is reliable to bypass from one component of your internet site to the subsequent, yet do no longer concern approximately it rendering your internet site wisely. in basic terms concern appropriate to the browsers.