|
-
August 6th, 2008, 04:39 AM
#1
Problem with div and h1 tag of HTML
Hi!
when h1 tag of HTML is nested inside div tag, in Netscape Navigator it leaves vertical space before h1 tag contents, which doesn't happen in IE. Why is it so?
example:
<div>
<h1>Contents</h1>
</div>
Thank you.
-
August 7th, 2008, 09:02 AM
#2
Re: Problem with div and h1 tag of HTML
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
August 7th, 2008, 09:03 AM
#3
Re: Problem with div and h1 tag of HTML
Have you tried changing the margin and padding?
Code:
<div>
<h1 style="margin: 0px; padding: 0px;">Contents</h1>
</div>
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
August 8th, 2008, 04:46 AM
#4
Re: Problem with div and h1 tag of HTML
Thanks for your reply. I tried it using "margin" property of CSS and it works fine in Netscape Navigator.
Though the above solution works, I want to know why it happens in Netscape Navigator and in other browsers except IE. Where is the problem? If we do the same thing using "table" tag instead of "div" it works fine without using "margin".
Thank you
-
August 8th, 2008, 04:54 AM
#5
Re: Problem with div and h1 tag of HTML
Because IE has different default to everyone else? Or, sometimes, thig come out differently if your code isn't quite correct all the way through (nesting mistake, etc. etc.)
Help from me is always guaranteed!*
VB.NET code is made up on the spot with VS2008 Professional with .NET 3.5. Everything else is just made up on the spot.
Please Remember to rate posts, use code tags, send me money and all the other things listed in the "Before you post" posts.
*Guarantee may not be honoured.
-
August 8th, 2008, 06:24 AM
#6
Re: Problem with div and h1 tag of HTML
According to W3C standards, there is no mistake in the code (nesting of HTML elements).
-
August 8th, 2008, 07:40 AM
#7
Re: Problem with div and h1 tag of HTML
It's not a mistake in the code, it's simply differences in web browsers. Any professional web developer/designer will tell you that the #1 problem in this industry is cross browser solutions.
Personally, I won't ever touch Netscape. It has declared its own end-of-life and therefore isn't worth the hassle. As long as what you write appears fine in IE, Firefox, and Safari for PC, as well as in Safari and Firefox for Mac, you will be okay! Those make up over 99% of the commonly used browsers.
Also, remember to always declare your doctype. This tends to be the distinguishing role in how cross browser implementation changes minimally. As long as the doctype is declared, you should need to make less revisions to your code for each specific browser.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
August 9th, 2008, 02:20 AM
#8
Re: Problem with div and h1 tag of HTML
Thanks for your reply. it cleared my doubt.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|