My paragraph has a height/line-height of 50px and text-align: center
, which centers the text. But p:before is causing it to increase in height/line-height, causing the text to bump down. I want both p and p:before to be vertically centered.
<p>Hover This</p>
p {
background: red;
text-align: center;
height: 50px;
line-height: 50px;
font-size: 14px;
}
p:hover:before {
content: "icon";
display: inline-block;
margin-right: 10px;
font-size: 3em;
}
The text length varies so I don't think i can just use position: absolute
for the icon...