PDA

View Full Version : CSS list with images


ralitza
08-12-2006, 08:22 PM
I would like the text to be aligned half way with the image, right now the text is aligned at the bottom.

http://www.iankovi.com/htmlfile.html
http://www.iankovi.com/cssfile.css

Kravvitz
08-13-2006, 02:42 AM
Try this.
#list img {
vertical-align: middle;
}

rmedek
08-13-2006, 08:27 AM
I don't think that will work unless the text and image are either in a table cell or have "display:table-cell" assigned (which, of course, doesn't work in IE).

Try making the line height of the text the same as the image. I.e., if the image is 16px tall:


li, li a {
line-height: 16px;
}


Nope, I take that back, I'm an idiot. Kravvitz'z method works great because it's an inline element… I'm so used to making images block-level elements I just assumed it wouldn't work! :o

ralitza
08-13-2006, 06:54 PM
That works well, but how would I remove the border around the image?

Edit: the text is a little off in Opera any suggestions?

VIPStephan
08-13-2006, 07:06 PM
That works well, but how would I remove the border around the image?
That's really basic knowledge and I know that you aren't all that new in this forum and to CSS :rolleyes: :

img {border: none;}

or if you only want to address images within anchors:

a img {border: none;}

Or border: 0; works as well.