I want to set the border at the top of the paragraph but instead it sets the border for every line of the paragraph.
p.s. I only want to style achieve this effect in paragraph not by the other style
Thanx in advance :D
It’s possible that you have set your paragraphs to display:inline;. If you want what @Paulie_D is showing, you’ll have to make sure that the paragraph is set to display: block, which is its default type.
@Paulie_D: Thanx for the reply paulie. I actually want it to be more flexible. Here I have tried by your code http://jsfiddle.net/prathoven/hQRc9/ .Instead I want margin only at the top of the first line(i,e margin to be actual width of the first line not the whole paragraph) not over the box. :D…. @Senff: Thanx for the nice comment :)
That’s a different thing you want than what you initially said then.
If you want to have the line at the top of the paragraph, use @Paulie_D ‘s example.
If you want to have the line at the top of the first line of the paragraph only, you’ll have to wrap it in a div or span and apply the line to that.
Indeed you can’t use a border on the first-line pseudo-element. You CAN, however, apply a background image to it, so if you have an image of a line, maybe you want to use that (and set it to repeat-x, obviously). Something like this: http://jsfiddle.net/senff/Wd8ck/
(for some reason it doesn’t always show right away — sometimes I have to switch to another tab and then switch back….hmm!)