Solved

<h2> Tag....is this normal behaviour ?

Posted on 2000-05-18
8
256 Views
Last Modified: 2010-04-09
Here is an example :

<html>
<head>
</head>
<body>
<table width=100% cellpadding=0 cellspacing=0 bordercolor=#003466 border=1>
<tr>
<td>
<h2>Test</h2>
</td>
</tr>
</table>
</body>
</html>

After the word "test" there is a new line or carriage return or whatever caused by the </h2> tag(note that if you remove the </h2> tag it goes away).

Is this normal ?
How can I stop it ?



0
Comment
Question by:ozymandias
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 15

Author Comment

by:ozymandias
ID: 2820941
BTW, I am using IE 5.0, but it does the same in Netscape also.
0
 
LVL 3

Expert Comment

by:messentary
ID: 2820956
Yes, this is normal.  Closing the h2 tag prevents the rest of the page from being displayed in the h2 font.
0
 
LVL 3

Expert Comment

by:messentary
ID: 2820957
and being a header, it will do a carriage return.  If you don't want the carriage return, don't use the <h2> tag, and use a <font size=5> tag instead.
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 22

Accepted Solution

by:
CJ_S earned 50 total points
ID: 2821034
but using the <font size=5> will give you different results on different settings of the browser.

Like messentary pointed out the carriage linefeed return will always be after a <Hx>.

To get the same result without the blank line you should instead use styles which have their height in pixels, and set it exactly like you want them. Then use those CSS styles within your own <font> tags...

Good luck,
CJ
0
 

Expert Comment

by:webhornet
ID: 2821061
or use some css...

<H2 STYLE="margin-bottom:0px">test</H2>

should work...

btw: you could also define stylesheets in the <HEAD> tag...

<HEAD>

.... title and meta stuff ...

<STYLE>
<!--
h2 {
margin-bottom:0px
}
//-->
</STYLE>
</HEAD>
<BODY>
....

this will give all h2s in you document a uniform shape...

webhornet
0
 

Expert Comment

by:webhornet
ID: 2821066
sorry cj s...
i was writing this stuff while you added this comment...
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2821094
it's okay, great minds have the same thoughts =/
0
 
LVL 15

Author Comment

by:ozymandias
ID: 2821319
Damn it...I had done this with a style sheet and it didn't work. Problem was I had missed the semicolon off the style line above the margin-bottom setting and I didn't notice <kicks self v.hard>.

H2
{
    COLOR: #003466;
    FONT-FAMILY: Verdana,Arial,Helvetica;
    FONT-SIZE: 12px;
    TEXT-DECORATION: none <==missing semicolon !
    MARGIN-BOTTOM:0px;
}

I guess CJ_S gets the points.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question