Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   HTML / XHTML / CSS (http://www.programmingforums.org/forum27.html)
-   -   XHTML/CSS Div formatting problem (http://www.programmingforums.org/showthread.php?t=15269)

MrMan9879 Feb 27th, 2008 9:30 PM

XHTML/CSS Div formatting problem
 
Hello guys, I'm having a bit of a problem with formatting divs for my website, and I would like some help with this. I've got a nav bar div that I would like to extend all the way to the bottom of the screen, so i assumed that height:100%; would be sufficient enough, but since testing it, I've discovered that it isn't. I've also read about it online, and apparently there are some errors with this.

I've tried setting the height element of the body, and all parent divs to 100% also, but I haven't had any luck. This is for a website I'm designing for a competition and also probably my school. <URL snipped>

Note: The site will probably not look as it is intended unless you're on Firefox at 1024x768 resolution as I'm not really done making it, and a lot of its scripts (ie. the poll on the left) are not working yet.

mrynit Feb 28th, 2008 1:05 AM

Re: XHTML/CSS Div formatting problem
 
post code or a valid URL

Ooble Feb 28th, 2008 4:53 AM

Re: XHTML/CSS Div formatting problem
 
Try setting the html element's height to 100% too. Some browsers need it, some don't.

mrynit Feb 28th, 2008 6:01 AM

Re: XHTML/CSS Div formatting problem
 
Quote:

Originally Posted by Ooble (Post 141656)
Try setting the html element's height to 100% too. Some browsers need it, some don't.

insn't that a hack?

Ooble Feb 28th, 2008 5:28 PM

Re: XHTML/CSS Div formatting problem
 
Nope. Some browsers treat html as a rendering element, and some don't. I don't know whether the W3C tells them to or not, but it's unimportant - it's hardly hacky.

mrynit Feb 28th, 2008 5:41 PM

Re: XHTML/CSS Div formatting problem
 
I thouhgt desinging to specific browsers was bad... of course the most popular browser doesn't follows W3C standards.

Ooble Feb 28th, 2008 6:58 PM

Re: XHTML/CSS Div formatting problem
 
Quote:

Originally Posted by mrynit (Post 141682)
I thouhgt desinging to specific browsers was bad... of course the most popular browser doesn't follows W3C standards.

Which is why it's accepted, if not ideal. Just get your website working in all browsers: how you do it is irrelevant.

MrMan9879 Mar 2nd, 2008 9:50 PM

Re: XHTML/CSS Div formatting problem
 
There is a change when I add height:100; to the HTML element, but it isn't the change I was looking for. I will show you guys my code.

index.php
:

<html>
  <head>
  ...
  </head>
  <body>
    <div id="container">
          ...
          <div id="leftBar">
              ...
          </div>
      ...
      </div>
  </body>
</html>


stylesheets
:

html {
        height:100%;
}
body {
        /* Code for the body element */
        font-family: Arial;
        font-size: 13px;
        margin:0 0 0 0;
        padding:0;
        background-color:#EEEEEE;
        height:100%;
}

...

#container {
        /* Code for the entirety of the page... contains the page */
        margin:0;
        border:thin;
        border-color:#000000;
        text-align:left;
        height:100%;
}

...

#leftBar {
        /* Code for the left sidebar */
        height:100%;
        margin-top:0;
        margin-bottom:0px;
        padding-left:5px;
        margin-right:20px;
        padding-top:5px;
        float:left;
        width:19.5%;
        height:100%;
        background-image: url(../img/sideBar.jpg);
        border-right: 1px solid #000000;
        border-bottom: 1px solid #000000;
        color:#000000;
        overflow:visible;
}


I removed large chunks of what I believed to be unimportant code to this situation. I don't know if this code will help, but I still can't get it to work how I would like it to.

MrMan9879 Mar 4th, 2008 12:07 AM

Re: XHTML/CSS Div formatting problem
 
Another problem I'm having is getting the layout to work properly in all browsers. My sidebar doesn't reach the top on any browser I've tested other than Firefox, and on IE and Opera, the <hr /> tags that I have dividing news posts don't seem to be lining up how I'd like. I'll add my url to my signature if people would like to take a look.

If you do look, I'd suggest viewing it on Firefox at 1024x768 to see it how it's intended.

privateD.lister Mar 4th, 2008 2:40 PM

Re: XHTML/CSS Div formatting problem
 
is this comp of which you speak being the thinkquest?


All times are GMT -5. The time now is 11:05 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC