Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Design Forum > Web Design & Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Web Design & Programming Discussion of web design, and server-side & client-side scripting

Reply
 
LinkBack Thread Tools
Old 12-17-2008, 07:21 PM   #1 (permalink)
Registered User
 
Palgie's Avatar
 
Join Date: Sep 2007
Posts: 53
OS: Windows XP Home SP2


CSS Dilema - Overflowing Content or Broken Navigation D=

Hey guys,

Never needed to ask for help before but I've ran out of ideas with this one.

I'm in the process of making a web development site and ironicly, came into a problem with the CSS.

I have a main content area like every site does where all the content goes. And then a navigation to the right of the content box for things like search, or additional links that I might want to add.



Because I need the navigation to be 100% height, its caused me a lot of time trying to get it to work. I need to set the .body and the .cont_nav css classes both to 100% height for the navigation height to work as I would "correctly".

However when .body has a set width its causing overflow of the text. (seen below)



And im hoping there is a way to get both the content not overflowing and height set to 100% so that the navigation can work.

Code:
.body <--- White Area with curl 
{
background-color: white; 
color: #333333; 
background-image: url(images/curl.jpg); 
background-repeat:no-repeat; 
height: 100%; <---- Problem
}

#wrap 
{
width: 75%; 
float: left;
}

.content 
{
padding-top: 70px; 
width: 80%; 
margin-left: 80px;
padding-bottom: 60px;
}

.cont_nav  <--- Right navigation
{
float: left;
width: 200px; 
padding-left: 15px; 
padding-right: 15px; 
background-color: #c9c9c9; 
border-left: 1px solid #a3a3a3; 
border-right: 1px solid #a3a3a3; 
height: 100%; <--- Only works when body height is set to 100%
}

.cont_nav_inner 
{
padding-top: 15px;
}
HTML Code:
<div class="body">
    <div id="wrap">
	<div class="content">
       <!-- MAIN CONTENT HERE -->
        </div>
    </div>
    <div class="cont_nav">
             <div class="cont_nav_inner">
              <img src="css/dropdown/themes/nvidia/images/ads.gif" alt="Sponsors" class="icon"/><h2 style="padding-bottom: 4px;">Sponsors</h2>
                <small>We are suppored by</small><br />
                <!-- Sponsored by images go here -->
                <hr />
            </div>
    </div>
</div>
I hope you can fully understand my situation, Im rubbish at explaining problems :P

Last edited by Palgie; 12-17-2008 at 07:36 PM.
Palgie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 12-17-2008, 08:04 PM   #2 (permalink)
Registered User
 
Join Date: Oct 2008
Posts: 30
OS: Linux


Re: CSS Dilema

I think I am understanding your problem. (I hope).

You don't really want the .body DIV to be 100% because this is forcing to flow down past your black and gray transparent bar at the bottom of the page.

However you cannot get the .cont_nav DIV to to size to 100% if the .body DIV is not at 100%.

Is that correct?

If so then keep in mind that the .body DIV does not have to be at 100%. It simply needs a size. When you set an element to a css height of 100% you are saying I want you to be 100% of your parents height. If that parent does not have a height set then it is technically 0 and you are getting 100% of 0

If you set .body to be 600px then .cont_nav will be 100% of 600px. You can absolutely set the height of .body to what ever you need and then set the .cont_nav to 100% to fill the full height of it's parent
CrimsonShroud67 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 12-18-2008, 03:16 AM   #3 (permalink)
Registered User
 
Palgie's Avatar
 
Join Date: Sep 2007
Posts: 53
OS: Windows XP Home SP2


Re: CSS Dilema

Hey Crimson,

Im glad you have managed to understand my problem :P

However you mentioned changing the .body to 600px for an e.g. however content will be inside the box and once the text inside reaches 600px in height, it causes the same situation as setting the height to 100%.

-Phil.
Palgie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 12-18-2008, 10:58 PM   #4 (permalink)
Design Team Member
 
Jaxo's Avatar
 
Join Date: Feb 2008
Location: Deming, NM
Posts: 312
OS: XP SP2 & Vista


Re: CSS Dilema

Your gray box on the bottom is using the float element if I am reading it correctly, correct?

Have you tried clear:both; on the box? Should create room for it to sit alone at the bottom with the body set at 100%...

In theory... or at least in my head it works, not sure about reality.

Hope that helps.

Code:
.cont_nav  <--- Right navigation
{
float: left;
clear: both;
width: 200px; 
padding-left: 15px; 
padding-right: 15px; 
background-color: #c9c9c9; 
border-left: 1px solid #a3a3a3; 
border-right: 1px solid #a3a3a3; 
height: 100%; <--- Only works when body height is set to 100%
}
Code bold above
Jaxo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 12-19-2008, 06:33 AM   #5 (permalink)
Registered User
 
Join Date: Oct 2008
Posts: 30
OS: Linux


Re: CSS Dilema

Can I see the code for the whole page?

It sounds like what you are saying is that the text, if it is longer then the height you set, will push the .body beyond that height and back down into the gray bar.

If that is the case then you could try this...

It looks like you have 3 basic rows on the page a header gray bar, content, and a footer gray bar. You could set relative heights on all of them so that they fill the page like 10% 80% and 10%. Then set overflow:auto; to the content div (.body) to allow large content to scroll when it gets too large to fit.

Ex
Code:
<html>
<head>
<title></title>
<style>
body, html{height:100%; margin:0;}
.header { height:10%; background-color:#999;}
.content{ height:80%; overflow:auto;}
.footer { height:10%; background-color:#999;}
</style>
</head>
<body>
<div class="header"></div>
<div class="content"></div>
<div class="footer"></div>
</body>
</html>

This will make the page keep the basic layout no matter what res the user has or how big his window is. However since the sizes are relative the actual DIV heights will vary based ion the size of the window. If you need to you can also set min-height to any element you do not want to shrink below a certain height, like you header with the logo.
CrimsonShroud67 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 04:18 AM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85