Solved

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

Posted on 2000-05-18
8
263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

691 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