tags:

views:

53

answers:

3

I am trying to centre the link with the image, but can't seem to move the content vertically in any way.

http://img693.imageshack.us/img693/6207/picture2pc.png

<h4>More Information</h4>
<a href="#" class="pdf">File Name</a>

The icon is 22 x 22px

.pdf{font-size: 12px;}
.pdf:before{padding:0 5px 0 0; content: url(../img/icon/pdf_small.png);}
.pdf:after{content: " ( .pdf )"; font-size: 10px;}
.pdf:hover:after{color: #000;}
+1  A: 

I'm no CSS expert, but what happens if you put vertical-align: middle; into your .pdf:before directive?

Chris
Awesome, middle did not work so I had to use a negative percentage instead, thanks for the heads up!
danixd
Glad to help. Did "middle" do nothing, or something-but-not-what-you-wanted?
Chris
A: 

Messing around with the line-height attribute should do the trick. I haven't tested this, so the exact value may not be right, but start with 1.5em, and tweak it in 0.1 increments until it lines up.

.pdf{ line-height:1.5em; }
MatW
+1  A: 

Answered my own question after reading your advice on the vertical-align CSS attribute. Thanks for the tip!

.pdf:before{padding:0 5px 0 0; content: url(../img/icon/pdf_small.png); vertical-align:-50%;}
danixd