Forum Moderators: not2easy
I've read previous posts and just cant seem to get it right.
Below is the html i'm using and the css from the style sheet.
Have i done something stupid or missed something simple.
Any help much appreciated
Thanks in advance
<div class="htmlcss">
<a href="http://validator.w3.org/check?uri=referer"><img src="/images/valid_html.png" alt="Valid HTML 4.01 Strict" height="31" width="88"></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="http:/images/valid_css.gif" alt="Valid CSS!" height="31" width="88"></a>
</div>
.htmlcss
{
display: block;
margin-left: auto;
margin-right: auto
}
.htmlcss {
border: 1px solid #000000;
margin: auto;
}
You would probably see it is the full with of the parent, rendering the margins useless. Put a width on it:
.htmlcss {
border: 1px solid #000000;
width: 176px;
margin: auto;
}
(Then remove the border.) You might have to play with the width a little, depending on how much padding or margin is taken up by the images. If necessary, add text-align:center to the selector.
These images are inline content, so you can use "text-align:center" on the parent (your htmlcss div) without having to guess an appropriate width. Much easier, much neater.