View Single Post
Old 07-02-2012, 09:26 AM   PM User | #3
Major Payne
Regular Coder

 
Join Date: Aug 2005
Location: MS
Posts: 745
Thanks: 7
Thanked 65 Times in 63 Posts
Major Payne is an unknown quantity at this point
Centering:

Centering an element requires setting a width that is less than 100%, using a proper document type and using the CSS property: margin: 0 auto; This is done in the CSS that styles the element. Using positioning rules just makes it harder and requires more coding. Suggest using the following at the very top of your CSS file. Then you can remove all those rules that have zero padding/margin:
Code:
* { margin: 0; padding: 0; border: 0; }
Example:

Code:
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:

Code:
.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:
Code:
<div class="selector_name">Content here</div>
Example as an ID:

Code:
#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:
Code:
<div id="selector_name">Content here</div>
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.

Typo?: "text-align:leftr;" Recommend validating:

Validating:

Why Validate?: http://validator.w3.org/docs/why.html
CSS Validator: http://jigsaw.w3.org/css-validator/
HTML Validator: http://validator.w3.org/#validate_by_uri+with_options
__________________
☠ ☠RON☠ ☠

Last edited by Major Payne; 07-02-2012 at 09:30 AM..
Major Payne is offline   Reply With Quote