- A Reuters reporter in Surkhrod district in Nangarhar province, where villagers said the raids took place, said Afghan police fired at the crowd after some of them started throwing stones at local government buildings.
In the above paragraph, I would like to use CSS to make all lines after the first line to automatically indent some space so that each line stays right after the - in the first line.
HTML
<p> - A Reuters reporter in Surkhrod district in Nangarhar province, where
villagers said the raids took place, said Afghan police fired at the crowd
after some of them started throwing stones at local government buildings.</p>
It's similar to a list item with list position set to outside, but I don't want to use a list.
What is the simplest way you can think of to achieve this effect? Less extra html markups will be better.
Many thanks to you all.
Not usable right now but if you activate the Experimental Web platform Flag on chrome you can use
text-indent:1em each-line;
which should do exactly what you want.text-indent on MDN
You need
text-indent
. Normallytext-indent
pushes the first line inwards, but if you give it a minus figure and use a positive margin, you can achieve the effect you're after.On inline elements maybe it works differently, I have noticed. I was needing an "outdent" (first line further left than rest of paragraph) and noticed the suggestions above did the opposite -- created a regular indent (where first line is further RIGHT than other lines). Here is what works for an inline element, for example, an "a" tag:
I also set the containing block-level element to have a margin of 1em, so that where the inline "a" elements commence, with their negative margins, they actually position exactly where I things would have been originally before messing around to make an "outdent".
Hope this helps someone! I also noticed there's no size control on the text-indent itself on my inline element, either....
JSFiddle Example