Forum Moderators: not2easy
Relatively simple question, though I can't seem to get the answer myself.
I want my <H2> tags to have a fixed width background of 115px, and a colour of grey (#ccc).
How can I get it to do this, without having to make a seperate class and then call <h2 class="background">?
Any suggestions would be appreciated!
Sorry, I should have mentioned - THat's already what I have. THe problem is that it doesn't recognize the "width" - it just shades grey the background to the length of the text.
For example <h2>Webmasterworld</h2> the grey background will stretch the width of that word, but not the specified 115px.
Is there a way to get it to do that?
115 is not very much and if the letters are to long, the bg will stetch to fit.
if you are wanting the h2 to kind of stick out over the end of the grey, you could use a grey gif with a height of 1px and width of 115px, and tile it vertically.
hope this makes sense..
Try this simple test...
h2 {width:200px; background-color:#CCC;}
h3 {width:200px; background-color:#036; display:inline;}
<h2>Blah blah</h2>
<h3>Blah blah</h3>