element
I am aware of the :first-line
selector in CSS, but I cannot find anything that will allow me to select the last line.
The reason I am trying to select the l
Unfortunately there is no CSS selector that would apply.
You can however select the first line using the pseudo element :first-line
. Unfortunately at the moment there is no equivalent for the last line.
You can use only one line and give css : nth-child(3)
Here (3) denotes the number of a last line
I don't think this can be done with CSS alone. jQuery or a PHP function might be able to get want you what
IIRC, the only css control over the last line is text-align:
text-align-last: right;
I'm afraid javascript, or actually wrapping the last line in a span and styling that, is the only way. Below is the JS for reference.
var thetext = document.getElementById('some_element').innerHTML.split(/\r?\n/);
alert(thetext[thetext.length - 1]);