HighDots Forums  

Different underline color for block elements

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Different underline color for block elements in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Florian Brucker
 
Posts: n/a

Default Different underline color for block elements - 10-03-2004 , 11:57 AM






Hi!

I'm trying to use a different underline color than the text color on my
headings using the border-bottom method. Unfortunately the underline
spans the whole width of the heading (not only the text), because
headings are block elements. Is there another way than using
extra-markup like

<div class="h1"><span>My heading</span></div>

to get an underline which only underlines the text?

Thanks for any hints,
Florian
--
Give a man a fish; you have fed him for today. Teach a man to fish,
and he will sit in the boat and drink beer all day. (OldFox)
[------------ http://www.torfbold.com - POV-Ray gallery ------------]

Reply With Quote
  #2  
Old   
Florian Brucker
 
Posts: n/a

Default Re: Different underline color for block elements - 10-03-2004 , 02:36 PM






Toby Inkster wrote:
Quote:
[use :before and :after]
A really nice idea! This brings me, however, to that point again where I
have to decide whether to use nice CSS2 or to take those IE users into
account (no flame wars on that topic, please
I'll have to check what it looks like when :before and :after are not
supported.

Thanks for the help!
Florian
--
If all goes well, you should see an ugly, loathsome, repulsive,
deformed window manager called twm, probably the smallest window
manager available. (Gentoo Linux Handbook)
[------------ http://www.torfbold.com - POV-Ray gallery ------------]


Reply With Quote
  #3  
Old   
Florian Brucker
 
Posts: n/a

Default Re: Different underline color for block elements - 10-03-2004 , 02:38 PM



Neal wrote:
Quote:
Underlining makes people think it's a link. Be careful with this.
Yep. It's for headings only.

Quote:
Toby's way may work. Another option is to set a width in ems for that
specific heading which works.
That would mean to set the width for each individual heading? In most
cases I'm not a friend of such methods - too much work to keep it
working (it's the same with images for headings, etc.).

Thanks nevertheless!
Florian
--
I have seen the future and it doesn't work. (Robert Fulford)
[------------ http://www.torfbold.com - POV-Ray gallery ------------]


Reply With Quote
  #4  
Old   
Neal
 
Posts: n/a

Default Re: Different underline color for block elements - 10-03-2004 , 04:06 PM



On Sun, 03 Oct 2004 17:57:13 +0200, Florian Brucker <torf (AT) torfbold (DOT) com>
wrote:

Quote:
Hi!

I'm trying to use a different underline color than the text color on my
headings using the border-bottom method.
Underlining makes people think it's a link. Be careful with this.

Quote:
Unfortunately the underline spans the whole width of the heading (not
only the text), because headings are block elements.
Yep.

Quote:
Is there another way than using extra-markup like

div class="h1"><span>My heading</span></div

to get an underline which only underlines the text?
Toby's way may work. Another option is to set a width in ems for that
specific heading which works.


Reply With Quote
  #5  
Old   
Markus Ernst
 
Posts: n/a

Default Re: Different underline color for block elements - 10-04-2004 , 07:15 AM



Florian Brucker wrote:

Quote:
div class="h1"><span>My heading</span></div
Do you apply the underline to h1? Then try to apply it to the span:

h1 span {
border-bottom:1px solid red;
}

HTH
Markus




Reply With Quote
  #6  
Old   
Florian Brucker
 
Posts: n/a

Default Re: Different underline color for block elements - 10-05-2004 , 06:01 PM



Quote:
div class="h1"><span>My heading</span></div

Do you apply the underline to h1? Then try to apply it to the span:
h1 span {
border-bottom:1px solid red;
}
No, that's not the problem When using the above markup, it's no
problem to get the desired effect. My question was if this could be done
*without* extra markup, i.e. "<h1>My heading</h1>". This seems to be
possible, according to the other answers I got.


Greetings,
Florian
--
All religions are founded on the fear of the many
and the cleverness of the few. (Stendhal)
[------------ http://www.torfbold.com - POV-Ray gallery ------------]


Reply With Quote
  #7  
Old   
Neal
 
Posts: n/a

Default Re: Different underline color for block elements - 10-05-2004 , 11:27 PM



On Wed, 06 Oct 2004 00:01:21 +0200, Florian Brucker <torf (AT) torfbold (DOT) com>
wrote:

Quote:
div class="h1"><span>My heading</span></div

Do you apply the underline to h1? Then try to apply it to the span:
h1 span {
border-bottom:1px solid red;
}

No, that's not the problem When using the above markup, it's no
problem to get the desired effect. My question was if this could be done
*without* extra markup, i.e. "<h1>My heading</h1>". This seems to be
possible, according to the other answers I got.

Try:

h1 {display: inline; border-bottom: 1px solid black;}


Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.