Right way to center-align contents of a div
I have this page that I just added an ad to on the right side:
http://www.comehike.com/hikes/search_hikes.php?redirect=yes&radius=&postal_code=
开发者_如何学GoI tried to wrap it in a tag, but that didn't work in this case. Any way I can simply make the ad get centered there instead of floating right?
Thanks!
The padding-left: 1em
on .content .chapter div
is throwing it off. Try removing that property.
From what I can see you have applied '1em' padding to the left of you div (shown below in the code taken from your stylesheet) which is what is causing your advert to move out of the range of your DIV (I think).
.content .chapter div {
padding-left: 1em;
text-align: left;
}
Try adding a class or id to the div containing the iframe of your ad and setting
padding-left: 0px;
Good Luck.
Try using this CSS style:
margin:0 auto
and if that doesn't work put a margin on the right by using:
margin-right:10px;
精彩评论