4 replies [Last post]
nyy
Offline
newbie
Last seen: 17 years 37 weeks ago
Joined: 2004-12-01
Posts: 3
Points: 0

When I use backgound-color with h2, it changes a whole line like a paragraph. Is it possible to only change the backgound of text using h2?

<h2 style="backgound-color: #000000">TEXT</h2>

Thank you.

Stu
Stu's picture
Offline
Enthusiast
Bristol uk
Last seen: 18 years 30 weeks ago
Bristol uk
Joined: 2004-01-20
Posts: 282
Points: 0

Bgcolor over text

Try display:inline;

It's not what you do it's the way that you do it.
So do it with STYLE
http://www.s7u.co.uk

nyy
Offline
newbie
Last seen: 17 years 37 weeks ago
Joined: 2004-12-01
Posts: 3
Points: 0

Bgcolor over text

Thanks, stu!
It is working!

I guess I would have to read more about inline, but it seems I cannot make the text center with inline?

Thanks again!

Stu
Stu's picture
Offline
Enthusiast
Bristol uk
Last seen: 18 years 30 weeks ago
Bristol uk
Joined: 2004-01-20
Posts: 282
Points: 0

Bgcolor over text

Just surrond h2 in a div with text-align:center;

<style type="text/css">
#container {text-align:center;}
h2 {background:#000; color:#fff; display:inline;}
</style>

<div id="container">
<h2>TEXT</h2>
</div>

It's not what you do it's the way that you do it.
So do it with STYLE
http://www.s7u.co.uk

nyy
Offline
newbie
Last seen: 17 years 37 weeks ago
Joined: 2004-12-01
Posts: 3
Points: 0

Bgcolor over text

Super!
Thanks very much!