Click here to get back home

CSS pseudo-element first-line no work

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
CSS pseudo-element first-line no work Martin Leese 01-06-2008
Posted by Martin Leese on January 6, 2008, 3:32 pm
Please log in for more thread options
Hi,

I am having trouble with CSS in that I can't
get the pseudo-element 'first-line' to work.

I have some pages that contain dialog. I use
a <dl> for this, with the character's name in
a <dt> followed by the words in a <dd>. This
is rendered as I wish with the first line not
indented, the following lines indented, and no
leading (whitespace) between the two.

However, it is bad practice to use HTML tags
for layout; layout should be in the style
sheet. So I thought I would use the CSS
pseudo-element 'first-line' to mimic the <dl>
layout. Here is a test page:

http://members.tripod.com/martin_leese/Marvin/test.html

I have viewed this using Firefox 1.5,
Netscape 7.02, and IE 5.50. Only Netscape
appears to work, and only for
class="dialogmargin".

Can somebody please explain what I am doing
wrong here.

--
Many thanks,
Martin Leese
E-mail: please@see.Web.for.e-mail.INVALID
Web: http://members.tripod.com/martin_leese/

Posted by Jonathan N. Little on January 6, 2008, 4:33 pm
Please log in for more thread options
Martin Leese wrote:
> Hi,
>
> I am having trouble with CSS in that I can't
> get the pseudo-element 'first-line' to work.
>
> I have some pages that contain dialog. I use
> a <dl> for this, with the character's name in
> a <dt> followed by the words in a <dd>. This
> is rendered as I wish with the first line not
> indented, the following lines indented, and no
> leading (whitespace) between the two.
>
> However, it is bad practice to use HTML tags
> for layout; layout should be in the style
> sheet. So I thought I would use the CSS
> pseudo-element 'first-line' to mimic the <dl>
> layout. Here is a test page:
>
> http://members.tripod.com/martin_leese/Marvin/test.html
>
> I have viewed this using Firefox 1.5,
> Netscape 7.02, and IE 5.50. Only Netscape
> appears to work, and only for
> class="dialogmargin".
>
> Can somebody please explain what I am doing
> wrong here.

Well firstly, no way, no how IE 5.50 will work because it does not
support :first-line pseudo element, (as well as many other CSS
properties). AS I recall FF1.5 supported it but all these browsers are
*old*, Firefox is at 2.0.0.11 with 3 soon to be release and Netscape is
officially dead and buried! Anyway there is an easier way, 2 classes.
This way it will work in these ancient browsers

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta http-equiv="content-language" content="en-us">
<title>Better</title>

<style type="text/css">
div.orator { margin: 0 1em; }
div.dialog { margin: 0 1em 1em 3em; }
</style>
</head>
<body>

<div class="orator">
Radio:
</div>
<div class="dialog">
Roger, your ship is out of control<br>
Robot override imperative, repeat imperative<br>
Suggest you assign control to Marvin
</div>

</body>
</html>


Follow up to: comp.infosystems.www.authoring.html
I don't have any NG listing: alt.html.css


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Posted by Martin Leese on January 9, 2008, 11:01 pm
Please log in for more thread options
Jonathan N. Little wrote:
> Martin Leese wrote:
>> Hi,
>>
>> I am having trouble with CSS in that I can't
>> get the pseudo-element 'first-line' to work.
...
>> I have viewed this using Firefox 1.5,
>> Netscape 7.02, and IE 5.50. Only Netscape
>> appears to work, and only for
>> class="dialogmargin".
>>
>> Can somebody please explain what I am doing
>> wrong here.
>
> Well firstly, no way, no how IE 5.50 will work because it does not
> support :first-line pseudo element, (as well as many other CSS
> properties). AS I recall FF1.5 supported it but all these browsers are
> *old*, Firefox is at 2.0.0.11 with 3 soon to be release and Netscape is
> officially dead and buried!

Some people consider support of older
browsers to be a good thing.

> Anyway there is an easier way, 2 classes.
> This way it will work in these ancient browsers
...
> div.orator { margin: 0 1em; }
> div.dialog { margin: 0 1em 1em 3em; }

This looks good; many thanks. I finally
settled on:
p.char {margin-bottom: 0}
p.dialog {margin-top: 0; margin-left: 40px}

> Follow up to: comp.infosystems.www.authoring.html
> I don't have any NG listing: alt.html.css

I do, so I have put it back :-)

--
Thanks again,
Martin Leese
E-mail: please@see.Web.for.e-mail.INVALID
Web: http://members.tripod.com/martin_leese/

Posted by Bergamot on January 10, 2008, 1:51 pm
Please log in for more thread options
Martin Leese wrote:
> Jonathan N. Little wrote:
>>
>> Well firstly, no way, no how IE 5.50 will work because it does not
>> support :first-line pseudo element, (as well as many other CSS
>> properties). AS I recall FF1.5 supported it but all these browsers are
>> *old*, Firefox is at 2.0.0.11 with 3 soon to be release and Netscape is
>> officially dead and buried!
>
> Some people consider support of older
> browsers to be a good thing.

1. support != look the same

2. The number of IE 5.x users has dwindled to tiny numbers, less than 1%
at sites I monitor. It's not worth the effort to try and coerce its
deficient CSS to give comparable results as more modern browsers. If it
degrades gracefully and the result is usable, good enough. The same
should hold true for any other browser, too.

3. Firefox versions prior to 2.0 are in much the same boat as IE 5.x,
especially since Fx automatically updates itself now. Graceful
degradation and usability are the keys. If you don't have them, you may
have bigger problems with the design as a whole.

>> I don't have any NG listing: alt.html.css
>
> I do, so I have put it back :-)

Never heard of alt.html.css myself. Consider the sister group to
ciwa.html: comp.info.www.authoring.stylesheets

--
Berg

Similar ThreadsPosted
Does this Work? November 20, 2008, 6:11 am
Would UBB thread work for this? March 9, 2006, 2:13 pm
How to get MAP to work with mouseover April 10, 2006, 10:59 pm
CSS positioning: why does this work? May 15, 2006, 2:12 pm
favicon doesn't work in IE6 October 8, 2006, 11:48 pm
This work on your browser? January 8, 2007, 1:27 am
Does my menu work in IE7? March 29, 2007, 9:51 am
Why didn't the include work? April 6, 2007, 8:12 am
2nd List Doesn't Work March 30, 2008, 11:34 pm
How does this work? (CDATA) May 6, 2008, 3:51 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap