..
To center an element horizontally, which has been assigned the float property (right or left) is necessary to use a container, having the same width of the float, which will assign the lateral margins with auto value. Here's an example:
# Wrap {
margin: 0px auto;
padding: 0px;
width: 600px;
}
# Floating {
margin: 0px;
padding: 0px;
text-align: left;
float: left;
width: 600px;
}
This structure of HTML:
<div id="wrap"> <div id="flottante"> ...</ div> </ Div>
| |
CSS (Course)
Web Design and Accessibility according to W3C CSS and XHTML. Starting from 29 €. |
| |
HTML (Course)
The markup language for the Web from 29 €. |
| |
Webmaster Advanced (Course)
Become a professional Webmaster. From 39 €. |