Solved

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

Posted on 2000-05-18
8
248 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
 
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
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.

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now