Another css question for you...

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

I have used css to change the appearance of H1 text which appears in a table cell which has a graphic behind it as the cell background, but the H1 text site right at the top of the cell. How can I tell it to put the H1 text in the middle of that cell, without having the space under it as well?

Julia - if life was meant to be easy Michael Angelo would have painted the floor....

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

The main problem is that Headers always have a line space underneath them. You can fix it two ways. One is not to use . Instead create another category in your stylesheets like this:

<?php
header
{ font-family:verdana, helvetica, arial, geneva, lucida, sans-serif; color:#000000; font-size:24px }
?>

and call it like so :.

The other way that I have seen it done is like this:

<?php
H1
{font-family:verdana, helvetica, arial, geneva,
lucida, sans-serif; font-size:24px \"verdana\"; color:
#000000;margin-bottom:0px;margin-top:0px}
?>

I haven't really tested this one though. Also 24px might be a little small.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Quote: I have used css to change the appearance of H1 text which appears in a table cell which has a graphic behind it as the cell background, but the H1 text site right at the top of the cell. How can I tell it to put the H1 text in the middle of that cell, without having the space under it as well?

Best solution, give it a class (assuming not all h1 elements will be in a table cell with a graphic behind them), then remove the spacing (only works in higher browsers).

h1.special {

font-family:verdana, helvetica, arial, geneva, sans-serif; 
font-size:24px;
color: #000000;
margin-bottom:-15px;
margin-top: 10px;
margin-left: 10px;
}

Smiling Suzanne

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

Thanks

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.