Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unwanted line feed 1

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
Hi All
Just started with this CSS stuff and discovering it has a mind of its own.
This code sets up the h5 font and colour in my style sheet.
Code:
h5 {font-family: verdana}
h5 {color: #336699}
This is the section of the page with the problem.
Code:
<td width="39%" bgcolor="#F0FFE1">
<h5><font face="Verdana">$LABEL</font></h5>
</td>
Without the style sheet, $LABEL prints normally.
With the style sheet, there is a line feed after the label.
Could someone tell me why?
Thanks

Keith
 
No, but try removing the margin from the <h5> element with CSS.

Also, you can condense your rules into 1.

Code:
h5 {
    font-family:verdana, sans-serif;
    color: #336699;
    margin-bottom:0;
}

I took the liberty of adding a "fall through" in case the user doesn't have Verdana (unlikely but possible). You should always do this.

May I ask why you are using <h5>? Do you 4 other, more prominent headline styles?

Foamcow Heavy Industries - Web design and ranting
Toccoa Games - Day of Defeat gaming community
Target Marketing Communications - Advertising, Direct Marketing and Public Relations
"I'm making time
 

I don't believe that font tags are part of the HTML specs any more... Using Foamcow's example and removing the font element altogether is the way to go.

Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Thanks for the info.

Foamcow
Your code solved the problem but I would like to know the cause.
There are many Heading statements in the full script.

BillyRay
I created a new Style Sheet to get to the bottom of the problem and a bit of Frontpage code found its way through the net.



Keith
 
The cause is that browser's automatically add a margin to <h> elements (among others). We just told it to use a value of 0 instead.

My guess as to why this doesn't happen without the stylesheet is that you are over-riding the browser's built in style rule for <h5> the moment you start to redefine it in a style sheet.

Foamcow Heavy Industries - Web design and ranting
Toccoa Games - Day of Defeat gaming community
Target Marketing Communications - Advertising, Direct Marketing and Public Relations
"I'm making time
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top