Wednesday 22 June 2016

Vertically aligning CSS :before and :after content




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



More Information


File Name



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;
}

Answer




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%;
}

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...