Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE Divides My Div 1

Status
Not open for further replies.

JeremyNYC

Programmer
Sep 23, 2002
2,688
0
0
US
First, I'm a database guy getting my feet wet with HTML, CSS, PHP, and whatever other letters I can find lying around. I've done a bunch of looking to try to solve this problem, but it's quite likely that I just don't know where to look. Sorry for the newbishness, but here goes...

I'm attempting to build a simple website for myself, finally getting away from CuteSiteBuilder! I'm doing this just using a text editor, grabbing bits of HTML and CSS and a couple of PHP includes to get a few things done.

The site will be quite straightforward, though I'd like to use standard chunks of text for header, footer, and (if I can figure out some suitable breadcrumb method) a left navigation bar.

To do the header, I used a PHP include, so that I would be able to keep the text in one file and have just one place to change it as things evolve. Works great.

Then I tried the same thing with the footer. Works great, in Firefox, but falls apart in IE. Basically, IE splits my DIVs apart, putting space between the meat of the page and the footer. Firefox renders them as contiguous, which is what I'd like.

I'd love any help in figuring out what I can do to make them contiguous in IE.

Here's the stuff I'm working with:
snippet from index.php:
Code:
	<BODY>
		<div id="container">
			<?php
				include ("header.php");
			?>
			
			<div id="leftnav">
				<p><a href="index.php"><em>Home</b></em></p> 
				<p><a href="Mission.php">Mission Statement</a></p> 
				<p><a href="Services.php">Services</a></p> 
				<p><a href="ClientList.php">Client List</a></p> 
				<p><a href="WhoWeAre.php">Who We Are</a></p> 
				<p><a href="ContactUs.php">Contact Us</a></p> 
				<p><a href="DevelopersSection.php">Developers' Section</a></p>
			</div
			
			<div id="content">
   			<p>blah blah blah</p>

   			<p>blah blah blah</p>

   			<p>blah blah blah</p>

   			<p>blah blah blah</p>
			</div>

			<?php
				include ("footer.php");
			?>
		</div>
	</BODY>

snippet from css file:
Code:
#container
	{
	width: 90%;
	margin: 10px auto;
	background-color: #fff;
	color: #333;
	border: 1px solid gray;
	line-height: 130%;
	}

#LogoSpace
	{
   min-height: 150px;
   background-color: #ddd;
	border-bottom: 1px solid gray;
   padding: .5em;
   float: left;
   width: 170px;
   margin: 0;
	}

#PageHeader
	{
	min-height: 150px;
	background-color: #ddd;
	border-bottom: 1px solid gray;
	padding: .5em;
	margin-left: 0px;
	font-family: sans-serif
	}

#PageHeader p
	{
	text-size: 200%;
	text-align: left -20;
	}
	
#leftnav
   {
   float: left;
   width: 170px;
   margin: 0;
   padding: 1em;
   }

#content
   {
   margin-left: 170px;
   border-left: 1px solid gray;
   padding: 1em;
   }

#footer
   {
   clear: both;
   margin: 0;
   padding: .1em;
   color: #333;
   background-color: #ddd;
   border-top: 1px solid gray;
   }

#footer p
	{
	text-align: center;
	font-size: 60%;
	font-family: sans-serif;
	}

#leftnav p 
	{ 
	margin: 0 0 1em 0; 
	}
	
#content h2 
	{ 
	margin: 0 0 .5em 0; 
	}
	
#CompanyName
	{
   margin: 0;
	font-size-adjust: 0.80;
	line-height: 200%;
	position:relative;
	left:30px
	}

#TagLine
	{
	font-size: 120%;
	line-height: 200%;
	position:relative;
	left:30px 
	}

img
	{
	margin: 0 auto;
	padding: 0 10;
	display: block;
	float: left;
	}

snippet from header.php
Code:
	<BODY>
		<div id="PageHeader">
			<img src="ABCblocks.gif">
			<h1 id="CompanyName">Company Name</h1>
			<h2 id="TagLine">Company Slogan</h2>
		</div>
	</body>

snippet from footer.php
Code:
	<BODY>
		<div id="footer">
			<p>Company Name ‡ Address ‡ Phone Number</p>
		</div>
	</body>

Again, just to be clear, my big problem is that the footer is disconnected from the rest of the content, and I'd like it all to be connected.

As bonus, IE doesn't render the left border of the Content DIV, though FF does.

Thanks much for any help in this.

Jeremy

---
Jeremy Wallace
ABCDataworks
You can find us on the web, and my e-mail is fairly easy to guess.
 
1. Add a doctype to your main page, as well as all the applicable elements that you need to create a valid page (<html><head><title> and so on). Make sure the page validates at W3 validator.
2. Remove the body tags from the included files. These are not frames. HTML page can have only one body tag and that one is around your main page. Everything from the included files will be simply injected in your main page at rendering time, which will mean you will have three body tags. So, remove the ones that are too much.

After you've fixed that come back if you're still experiencing problems.

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
Thanks for the response. I did have that stuff in the main page, I just didn't show it here. But removing the body tags from the footer only managed to make the footer look broken in both browsers. This is definitely an improvement, as it will make it easier to fix, though I'm still not having luck getting it right.

Once I did that stuff, and made a few other changes, I did get the page to validate HTML 4.01 strict. Thanks for getting me to deal with that early in the process.

The pages are at /NewSite, based on the company name in my sig file.

I would definitely appreciate any pointers to help me get that footer to display contiguous with the rest of the bordered page.

There are some other issues, but I'll try to stick to tackling them (or asking others for help doing so!) one at a time.

Thanks much.

Jeremy

PS: Is it better for me to post the code here or give out the URL as I did in this second post of mine?

---
Jeremy Wallace
ABCDataworks
You can find us on the web, and my e-mail is fairly easy to guess.
 
URL is better but I checked the NewSite and did not see any problems with it in IE7 or FF. Where is the problem occuring?

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
Oh. Yeah, sorry. That was dumb of me. I was trying something else out, and I put it at that same URL. I've moved the pages that were giving me trouble back to that URL.

Jeremy

---
Jeremy Wallace
ABCDataworks
You can find us on the web, and my e-mail is fairly easy to guess.
 
Your problem is quite simple. You did not close the div after the navigation menu which causes browsers to differently interpret that missing closing tag:
Code:
				<p><a href="DevelopersSection.php">Developers' Section</a></p>

			[!]</div[/!]

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
Excuse me while I cry a little.

Good to know that simple mistakes here in the land of HTML can be just as devastating as those in the land of VB, SQL, and anywhere else I've got experience.

Thanks much for finding that for me. I'll try to catch the next several dozen on my own!

Jeremy

---
Jeremy Wallace
ABCDataworks
You can find us on the web, and my e-mail is fairly easy to guess.
 
provided you try to keep your pages valid anyway.
I thought it was pre-requisite here ;-)

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
From my second post here said:
Once I did that stuff, and made a few other changes, I did get the page to validate HTML 4.01 strict. Thanks for getting me to deal with that early in the process.
I just undid the fix and it still validates. Hmmm.

I'll leave that page broken for a little while, in case anyone is interested enough to play with it and figure out why the validator didn't catch it.

For now, though, I'll just say thanks again to Vragabond for finding the error of my ways.

In general, from what's been said here, can I take it that the validator catches most stuff like this?

Jeremy

---
Jeremy Wallace
ABCDataworks
You can find us on the web, and my e-mail is fairly easy to guess.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top