Solved

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

Posted on 2000-05-18
8
258 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
innerHTML 7 34
Powershell output to email works, but readability is low 5 38
Media Queries  not Firing 6 17
output of netstat -r in Powersshell HTML 3 20
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

789 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