Reputation: 1148
is there a way for me to add line-hight:22px;
to any texts that has two lines or more.
but not affect text that does not go onto a second line ?
Is there a way to achive this in css only ?
Upvotes: 9
Views: 5694
Reputation:
You can with pure CSS, but beware of IE8 and below. Here is the browser support.
.class {
line-height: 22px;
}
.class::first-line {
line-height: 1;
}
What this does it set everything to a line-height
of 22px, but resets the first line to a line-height
of 1, you could also use 100% etc. That should do what you're wanting to achieve.
Upvotes: 14