I have
<div>
<center>
<img>
</center>
</div>
I've tried div img, div center img, div > img, can't seem to get it right.
I have
<div>
<center>
<img>
</center>
</div>
I've tried div img, div center img, div > img, can't seem to get it right.
img
, center img
, div img
and div center img
will all work. If you've tried this and it isn't working, it's not your selector that's failing.
You shouldn't use center tags because it has been deprecated, to display something in the center try:
CSS:
div img {
text-align: center;
/*or margin: 0 auto;*/
}
HTML:
<div>
<img>
</div>
Hope it helps. :)
I'm not quite clear on what you're trying to do.
If you're trying to get the <img>
:
div img
should do it.
If you're trying to get <div>
s that contain <center>
, CSS doesn't do 'backtracking', so I'm not sure if that can be done.
As others have said, the <center>
tag is not the best thing to use if you can avoid it.