Wednesday, 15 January 2014

css - Is it possible to give a text different style when it's short in one line or too long so that wrapped? -



css - Is it possible to give a text different style when it's short in one line or too long so that wrapped? -

i want show title of books in page. title short can show in 1 line, , long wrap 2 lines.

is possible set different styles (say: color, or line-height) 2 cases, using css?

e.g. if title in 1 line, set color green. if it's long or user resize window smaller one, displayed in 2 lines, set color yellow?

i think impossible css. need utilize javascript in order count characters or words in line.

another solution utilize pseudo-element ::first-line http://www.w3schools.com/cssref/sel_firstline.asp

but doesn't allow alter whole paragraph style, first line, while rest have main css.

css

No comments:

Post a Comment