Jump to content


Unwanted bottom gap - 100% height


16 replies to this topic

#1 Quimp

    Young Padawan

  • Members
  • Pip
  • 18 posts

Posted 15 October 2005 - 12:14 PM

Hello dear community,
I came across a problem I didn't noticed before. At the bottom of my pages, there is an unwanted gap. The main table (old school coding, I know) is set so its height is 100%. Oddly enough, this problem isn't present on pages that have more text, or stated otherwise, pages that scroll. Convertion to DIVs will come later, after my site goes public. The problem occurs in IE and Firefox, I haven't tried with other browsers.

Incorrect page: http://www.quimp.net/
Correct page: http://www.quimp.net...maker/examples/
CSS Stylesheet: http://www.quimp.net/style.css


Posted Image


Any ideas for what causes this?

Thanks in advance,
Quimp.

Edited by Quimp, 15 October 2005 - 12:16 PM.


#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 15 October 2005 - 12:25 PM

First off, i'd like to know what you mean by "off the whizz."

Second, try adding the following to your style sheet:
body { margin-bottom:0; }


#3 Quimp

    Young Padawan

  • Members
  • Pip
  • 18 posts

Posted 15 October 2005 - 12:37 PM

I already had a margin: 0px; in the body, so adding margin-bottom: 0; didn't work.

By 'off the whizz,' I'm refering to the gap at the bottom. Here's another screenshot-part in case the last one wasn't clear enough:

Posted Image

#4 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 15 October 2005 - 06:28 PM

Sorry, didn't look at your code, just guessed.

First, i would suggest changing your doctype to this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Because of IE's quirks mode.
Then try adding - height="100%" to the main table, and see if that helps. Or if you want you can do it in CSS - style="height:100%;"

#5 Quimp

    Young Padawan

  • Members
  • Pip
  • 18 posts

Posted 16 October 2005 - 01:21 PM

I made both modifications but it didn't work, it's still the same way it was.

Thanks for the help though, I much appreciate it, and for the link you provided.

#6 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 16 October 2005 - 03:31 PM

Well then the last thing that i can think of to do is to use positioning. While i'm not sure whether or not it will work on a table, or how much it will mess up in the end, it's worth a try.
Add to opening table tag:
style="posistion:absolute; bottom:0;"


#7 Quimp

    Young Padawan

  • Members
  • Pip
  • 18 posts

Posted 16 October 2005 - 07:38 PM

Adding this CSS caused the table to start at the bottom, but it left aligned it (rather than being centered) and removed the scrollbar (only the bottom of long pages was visible). I'm clueless!

#8 coolaid

    P2L Jedi Master

  • Members
  • PipPipPipPip
  • 1,435 posts
  • Gender:Male
  • Interests:i wonder..

Posted 16 October 2005 - 08:16 PM

ummmm... with a correct doctype, use

body,html{
    border:0;
    padding:0;
}

along with making sure there is no margins on the table with the white background....

#9 Lift

    Young Padawan

  • Members
  • Pip
  • 89 posts
  • Location:ON, Canada

Posted 17 October 2005 - 04:42 AM

Hi .... uhmm I just registered to try to give you a hand :worthy: . Been browsing this site for a while and I just wanted to make sure I'm actualy gonna use the account I created since I have joined many forums .. just never stuck with it :P But yeah, what you are trying to achieve is a pain in the rear and I haven't seen any tutorials to fix this for all browsers but I finaly go it to work.

---Uhmmm yeah, so back to our previous program --------

Instead of me picking at your code and changing this and changing that and end up confusing both of us, I will just drop down the steps I took inorder to achieve this I guess you can call it "Faux 100% height layout".

--

1. XHTML (this is HTML in your case but I will refer to it as XHTML due to the doctype below, it should work in both since I will be refering to the CSS mostly)

Ok, I see that rc69 mentioned the doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

--

2. CSS:
html,body{
height:100%;
margin:0px auto;
text-align:center;/*for IE5*/
padding:0px;
border:0px;
background-color: #E0E0E0;
}
-You will notice the html,body (mentioned by coolaid) there and you guessed right, replace your present body{} to what you see above. This is an important part in order to achieve this effect properly in most browsers. Keep in mind that when you want 100% height to work you must have a 100% parent container .... in this case the html,body acts as a parent container that is 100% in height.
--
3. XHTML:
<div class="container"></div>
- Now correct, thanks for catching that rc69 (was <div=class"container"></div>
-The container will go around all of your tables that you have at the present. This is also called a wraper div or what ever you wanna call it.

css:
.container_div{height:100%;
display:table; /* Opera and FireFox (fix the viewport content overflow */
}

-Here you need to create another background image, I noticed you are using 1 table on each side for the dropshadow, either take a screenshot or go back to your drawing application and slice a 1px image of your entier layout ending on both sides of the dropshadow ... this means you will have a 1px height image that spans across your whole layout. Ok, so 1 background dropshadow image not 2 as you have now.

--

This should work for you now.

What I have done here is add a container div that streaches 100% in height. No matter what resolution your screen is at, your container div will streach.

Since you are using tables for the most part you can set your main tables at 100% to streach accordingly.

So it's your container div that is actualy doing the 100% work, your content can be like only 300px but you will always have the satisfaction of getting that bottom part to streach.

This will also work with a "only div layout" perfectly, you can check an example of my implementation of this at thephotoguys.net.


--------- NOTE: ----------

It's like 5:30am ... haven't slept yet, so please forgive me if I fumbled this up in anyway, let me know if it works and if not I'm willing to go over this again or check out your attempt. Always do tweaking with a copy of your work just in case you get lost or end up messing up.

Lift OUT !! :D

Edited by Lift, 17 October 2005 - 03:25 PM.


#10 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 17 October 2005 - 03:15 PM

Note, XHTML is a strict pain in the..., and causes more errors when validating that with the doctype i provided.

Quote

3. XHTML:
CODE 
<div=class"container"></div>


-The container will go around all of your tables that you have at the present. This is also called a wraper div or what ever you wanna call it.
<div class="container"></div>
5:30 a.m. So i'll give you a break on that one.

#11 Lift

    Young Padawan

  • Members
  • Pip
  • 89 posts
  • Location:ON, Canada

Posted 17 October 2005 - 03:19 PM

Quote

rc69: <div class="container"></div>
5:30 a.m. So i'll give you a break on that one.
Hey !! Who moved that !! Those darn invisible Code Monkeys !! :ph34r: Gotta de-monkeyfy (that is SO totaly not a word :P) my system :nea:

#12 Quimp

    Young Padawan

  • Members
  • Pip
  • 18 posts

Posted 17 October 2005 - 03:26 PM

Your post was on top of my expectations! Thanks a lot for the in-depth tutorial and for actually joining this forum to help me out.


Quote

-Here you need to create another background image, I noticed you are using 1 table on each side for the dropshadow, either take a screenshot or go back to your drawing application and slice a 1px image of your entier layout ending on both sides of the dropshadow ... this means you will have a 1px height image that spans across your whole layout. Ok, so 1 background dropshadow image not 2 as you have now.
Making the width a fix value would make things a lot easier, but what if I wanted to keep it relative (in percentage)?

Here's what I did:
1. I changed the doctype;

2. I changed my body {...} CSS into the provided code;

3. I added a div around all tables without removing the main one, which I think is what you wanted me to do. Because I'd like to have the width set to 95%, I can't use one static image (hence why I used to initially).

After all these changes, the result remained the same. Any ideas on how to apply this technic to % widths?


Major thanks once again, that was a very informative post!
Warmest regards.


Edit: How slow of a typer am I? 3 posts were made while wrote this! I did notice the mistakes and corrected them before testing.

Edited by Quimp, 17 October 2005 - 03:28 PM.


#13 Lift

    Young Padawan

  • Members
  • Pip
  • 89 posts
  • Location:ON, Canada

Posted 17 October 2005 - 03:54 PM

Ok first of all:

Found an error on your CSS:
body, html

 {

  height: 100%;

  margin: 0px auto;

  text-align: center

  padding: 0px;

  border: 0px;

  background-color: #E0E0E0;

 }

Make sure to close your text-align: center it should be text-align: center; you are just missing the semi-col


Now do the following:

HTML:
class="fix"
-Add that to your first table that appears in your code

CSS:
.fix{height:100%;}
-Add that to your CSS file

Just checked it in FF and it works perfectly :) I gotta jet so I can't test it in other browsers .. but let me know what happens.

Ciao

#14 Quimp

    Young Padawan

  • Members
  • Pip
  • 18 posts

Posted 17 October 2005 - 08:02 PM

Hum... oddly enough that didn't do the trick in neither Firefox or IE. I tried a few alternatives as well. Note that I removed the text-align: center; after testing, because I didn't like its behavior. It came to my mind that perhaps the align="center" on my table tag could cause some troubles, but it unfortunately wasn't the case.

#15 Lift

    Young Padawan

  • Members
  • Pip
  • 89 posts
  • Location:ON, Canada

Posted 17 October 2005 - 08:28 PM

Ok, uhmmm dude? I got it to work ... you are adding the class="fix" to the main table right? Not just the CSS part?

I got it working just fine over here.

I only modified the page that your link was pointing to. You will have to add the changes to the rest of them.

I hope this helps.

I tested the modified page in FF 1.0.7, Opera 8.5, IE6, NN 8.0 .... looks to be working ok.
-- The dropshadow of the layout flows right down to the bottom of the screen --

I don't know maybe I'm missing the point of what you are trying to achieve, so can you please let me know if the file that I modified is displaying accoring to what you were after? If it's "not", could you please do a screen shot and point out what the problem is?

Thanks man, hope we can get this to work out for you.

Ciao

Attached Files



#16 Quimp

    Young Padawan

  • Members
  • Pip
  • 18 posts

Posted 17 October 2005 - 08:52 PM

Holy cow... sorry for wasting so much of your precious help. I was looking into the problem from too close. Instead of writing class="fix", I wrote style="fix". Haaa! must be the code monkeys.

So yeah, everything works as expected. Thanks a lot Lift and everyone else. Lift, if you'd like an inbound link from a PR4 website, just drop me a PM and I'll add a link to you on another website of mine (that's cheap, I know, but whatever...)

Mad thanks again.
Kindly,
Quimp

#17 Lift

    Young Padawan

  • Members
  • Pip
  • 89 posts
  • Location:ON, Canada

Posted 17 October 2005 - 09:19 PM

Hey man, any time .. that's what this is all for. Drop me a PM so I remember your offer, I do appreciate it.

Appreciating some one's help is excellent, remembering them when they are in need ... "pricless" :)

Glad I could help :D





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users