![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, I am using CSS to apply a background to a header: h1>Header</h1 h1 {background-color: black;} The problem is that the background color is applied not only to the text but to the full lenght of the h1. How to apply it only to the header text? Thanks, Miguel |
#3
| |||
| |||
|
|
Hello, I am using CSS to apply a background to a header: h1>Header</h1 h1 {background-color: black;} The problem is that the background color is applied not only to the text but to the full lenght of the h1. How to apply it only to the header text? |
#4
| |||
| |||
|
|
h1><span>Header</span></h1 h1 span{background-color: black;} |
#5
| |||
| |||
|
|
shapper wrote: Hello, I am using CSS to apply a background to a header: h1>Header</h1 h1 {background-color: black;} The problem is that the background color is applied not only to the text but to the full lenght of the h1. How to apply it only to the header text? |
|
3) Change display like a table cell... h1 { color: white; background-color: black; display: table-cell; } PROS: Does exactly what you wish, but leaves IE out of the picture |
|
CONS: Even though this would be the perfect solution, with IE's market share it will be a hard case to make (even though from a designer's perspective "life would be great" if IE would just go away...) |
#6
| |||
| |||
|
|
Block element displayed inline add zoom to trigger haslayout mayhaps result in inline-block behavior for IE. !--[if IE] style type="text/css" h1 { display:inline; zoom:1; } /style ![endif]-- |
#7
| |||
| |||
|
|
BootNic wrote: Block element displayed inline add zoom to trigger haslayout mayhaps result in inline-block behavior for IE. !--[if IE] style type="text/css" h1 { display:inline; zoom:1; } /style ![endif]-- A code fork is a code fork....I still stand by my comment...I do not have a rosy memory of the browser-war 90's. -- Take care, Jonathan ------------------- LITTLE WORKS STUDIOhttp://www.LittleWorksStudio.com |
#8
| |||
| |||
|
|
I see using span tags inside other tags very often for solving a few issues like in menus that uses lists. For example: ul li a id="singup" href="/signup/" span Sign-Up /span /a /li li a id="tour" href="/tour/workflow" span Tour /span /a /li /ul |
#9
| |||
| |||
|
|
h1 span{ color: white; background-color: black; } |
#10
| |||
| |||
|
|
shapper wrote: I see using span tags inside other tags very often for solving a few issues like in menus that uses lists. For example: ul li a id="singup" href="/signup/" span Sign-Up /span /a /li li a id="tour" href="/tour/workflow" span Tour /span /a /li /ul What issue does the addition of a span do for you here? -- Take care, Jonathan ------------------- LITTLE WORKS STUDIOhttp://www.LittleWorksStudio.com |
![]() |
| Thread Tools | |
| Display Modes | |
| |