Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > can you :first-line pseudo-element a class?

Reply
Thread Tools

can you :first-line pseudo-element a class?

 
 
Troy Piggins
Guest
Posts: n/a
 
      02-22-2006
I have a div class "note" which may or may not be more than one line of
text.

<div class="note">
text text dlkhf sdlkfjdsf
sdlkfj sldkjf sdlkjf sldk jf
dlfkjdlkjfldkjflkdjfljkd
</div>

I want the first line of "note" to be indented more than the others, so
tried this in the stylesheet:

div.note:first-line {
padding-left: 30px;
}

But it seems to have no effect. How do I achieve this? The only
examples I've seen operate on simple tags like p:first-line {...} etc.

PS - I also tried div:first-line.note {...} but no effect either.

Thanks for any pointers.

--
Troy Piggins
Ubuntu 5.10 pkgs : kernel 2.6.12-9-386, postfix 2.2.4, procmail 3.22
Compiled from src : slrn 0.9.8.1/rt (score_color patch), mutt 1.5.11i
vim 6.4
 
Reply With Quote
 
 
 
 
Mark Parnell
Guest
Posts: n/a
 
      02-22-2006
Deciding to do something for the good of humanity, Troy Piggins
<usenet-> declared in alt.html:

> div.note:first-line {
> padding-left: 30px;
> }
>
> But it seems to have no effect.


That's because padding doesn't apply to :first-line.

"Only the following properties apply to a :first-line pseudo-element:
font properties, color properties, background properties,
’word-spacing’, ’letter-spacing’, ’text-decoration’, ’vertical-align’,
’text-transform’, ’line-height’, ’text-shadow’, and ’clear’."
http://www.w3.org/TR/CSS21/selector....st-line-pseudo

It does go on to say that UAs may apply other properties as well, but
that will be different in each browser.

--
Mark Parnell

Now implementing http://blinkynet.net/comp/uip5.html
 
Reply With Quote
 
 
 
 
Troy Piggins
Guest
Posts: n/a
 
      02-22-2006
* Mark Parnell wrote:
> Deciding to do something for the good of humanity, Troy Piggins
><usenet-> declared in alt.html:
>
>> div.note:first-line {
>> padding-left: 30px;
>> }
>>
>> But it seems to have no effect.

>
> That's because padding doesn't apply to :first-line.
>
> "Only the following properties apply to a :first-line pseudo-element:
> font properties, color properties, background properties,
> ?word-spacing?, ?letter-spacing?, ?text-decoration?, ?vertical-align?,
> ?text-transform?, ?line-height?, ?text-shadow?, and ?clear?."
> http://www.w3.org/TR/CSS21/selector....st-line-pseudo
>
> It does go on to say that UAs may apply other properties as well, but
> that will be different in each browser.


D'oh - sorry about that. Thanks.

Changed to this and it works:

..note:first-letter {
padding-left: 30px;
}

Interestingly this appears (renders?) the same in Firefox:

div.note:first-letter {
padding-left: 30px;
}

but in IE the first letter seems to inherit .note's padding, margin,
border properties etc.

--
Troy Piggins
Ubuntu 5.10 pkgs : kernel 2.6.12-9-386, postfix 2.2.4, procmail 3.22
Compiled from src : slrn 0.9.8.1/rt (score_color patch), mutt 1.5.11i
vim 6.4
 
Reply With Quote
 
Leif K-Brooks
Guest
Posts: n/a
 
      02-22-2006
Troy Piggins wrote:
> I want the first line of "note" to be indented more than the others, so
> tried this in the stylesheet:
>
> div.note:first-line {
> padding-left: 30px;
> }


Use text-indent instead:

div.note {
text-indent: 30px;
}

You should probably also indent with em, not px:

div.note {
text-indent: 2em;
}
 
Reply With Quote
 
Troy Piggins
Guest
Posts: n/a
 
      02-22-2006
* Leif K-Brooks wrote:
> Troy Piggins wrote:
>> I want the first line of "note" to be indented more than the others, so
>> tried this in the stylesheet:
>>
>> div.note:first-line {
>> padding-left: 30px;
>> }

>
> Use text-indent instead:
>
> div.note {
> text-indent: 30px;
> }
>
> You should probably also indent with em, not px:
>
> div.note {
> text-indent: 2em;
> }


Yep - that's better. Thanks.

--
Troy Piggins
Ubuntu 5.10 pkgs : kernel 2.6.12-9-386, postfix 2.2.4, procmail 3.22
Compiled from src : slrn 0.9.8.1/rt (score_color patch), mutt 1.5.11i
vim 6.4
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I have no idea, you didn't say what country state or city you're in and you can't even write a proper post anyways. richard Computer Support 7 08-01-2010 09:12 PM
if you have free time ,you can chose the pro of you like sara_love67 Computer Support 7 09-25-2007 08:29 PM
if you have free time ,you can chose the pro of you like sara_love67 Digital Photography 0 09-24-2007 08:19 PM
Can you persist table cell values like you can do with form field values? Richard Dixson ASP .Net 1 05-18-2004 03:47 AM
Pokey, can you hear me? Pokey, Can you see me? =?ISO-8859-1?Q?R=F4g=EAr?= Computer Support 1 12-02-2003 05:30 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57