DZone ForumsDZone Forums  

Go Back   DZone Forums > Community > Design & Usability > CSS & HTML
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
LinkBack Thread Tools Display Modes

Topic: Link with image and text centered vertically
Old 06-11-2008, 09:12 AM   #1 (permalink)
Member
 
Join Date: Jun 2008
Posts: 1
Hi, I'm trying to create a link with an image and a text. I want the text vertically aligned with the image (if you don't make it explicity, the text appears aligned to the bottom of the image). I get it only this way:

.myButton {
color: black;
font-family: Verdana;
font-size: 11px;
text-decoration: none;
white-space: nowrap;
}

.myButton #buttonLabel {
position: absolute;
padding-top: 6px;
padding-bottom: 6px;
padding-left: 4px;
}

<a href="x" class=myButton>
<img src="image.gif"/>
<span id="buttonLabel">LabelText</span>
</a>

But, as the inner span has position absolute, it is out of the normal flow of elements, and when I want to have a number of these links in the same row, only the images take it place one after another, but the texts overlap one over another.

Is there any other way to do this, avoiding this problem?

Thanks
DanielB is offline   Reply /w Quote -


Thread Tools
Display Modes




All times are GMT -5. The time now is 06:06 PM.