iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Graphics & Design Discussion Forum Post your graphics design questions/comments/ideas in here. Ask questions, post tutorials, discuss trends and best practices. Sub-forum for website accessibility and usability.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-27-2008, 11:30 PM
WebProWorld Member
 
Join Date: Feb 2004
Location: New York
Posts: 82
JSeverson RepRank 0
Default CSS Layout Help

Hi,
I'm trying to lay out a site with CSS, which I've done numerous times, but I've run into problems with a current layout and I just can't figure out what the issue is. Once the copy exceeds a certain length, the background color for the footer disappears and the borders on the left and right side do not extend to the full length of the page. When I add overflow:auto; to the container div, it fixes the problem but then I end up with scroll bars on that div.

All of the xhtml and css validate. And, oddly enough, IE6 is the only site it appears properly in. I'm sure it is something small that I'm just overlooking. Could someone take a look?

Page with full copy that breaks:
Full Copy

Page with partial copy that is correct:
Partial Copy

Thanks,
__________________
Jeff T. Severson
J.T.S. Design, Inc.
Reply With Quote
  #2 (permalink)  
Old 04-28-2008, 06:08 PM
WebProWorld Pro
 
Join Date: May 2004
Location: anchorage, alaska
Posts: 241
jomariet RepRank 0
Default Re: CSS Layout Help

You might want to add a Clear div to your style sheet and add it at the bottom of each floated element. I've found it works best if you add something to the div even a nbsp .

In your style sheet it would look like:
.clear {clear:both;}

just before the close of your floated division you would add:

<div class="clear">&nbsp;</div>

This has worked for me in similar situations.

JM
__________________
http://www.akalt.net - Alaskan Web Hosting
http://www.crucibledesigns.com - Web Design & Development
http://www.jomaries.com
Reply With Quote
  #3 (permalink)  
Old 04-28-2008, 07:25 PM
WebProWorld New Member
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 5
darocha RepRank 0
Default Re: CSS Layout Help

Hi JSeverson,

Here's the fix for your layout:

html, body, #container { height: auto; }
body { min-width:758px; }
#container
{
float:left;
position:relative;
margin-left:50%;
left:-379px;
margin-right:-758px;
}

First remove the height attribute from html, body and #container. IE7 and Firefox are not ignoring these rules, and they are indeed rendering as expected. however, they will not work for the layout you are trying to achieve.

Add a min-width to the body the same width as your #container. Then center align your #container div.

I can't tell what will happen with IE6 after you add these, the snippet above will fix the layout for IE7 and Firefox.

Clear won't work in this situation. You should use clear when you want to "CLEAR" other floated elements from the side of a particular element. Eg: You have a 2 floated div elements which are 100px wide each, inside another div element with width of 300px; The divs will render side by side. Then you could use 'clear:left' on the second element to so it will flow below the 1st element instead of its side.

Thanks,
Darocha
Reply With Quote
  #4 (permalink)  
Old 04-29-2008, 01:13 AM
WebProWorld New Member
 
Join Date: May 2006
Location: Zadar, Croatia
Posts: 17
hrvoje461 RepRank 0
Default Re: CSS Layout Help

Quote:
Originally Posted by jomariet View Post
You might want to add a Clear div to your style sheet and add it at the bottom of each floated element. I've found it works best if you add something to the div even a nbsp .

In your style sheet it would look like:
.clear {clear:both;}

just before the close of your floated division you would add:

<div class="clear">&nbsp;</div>

This has worked for me in similar situations.

JM
I think it is pretty simple solutions that works every time in situations when you hava a floating elements on your site.
I would also add min-height instead of height in your css file.
Reply With Quote
  #5 (permalink)  
Old 04-29-2008, 01:16 AM
WebProWorld Member
 
Join Date: Feb 2004
Location: New York
Posts: 82
JSeverson RepRank 0
Default Re: CSS Layout Help

Thank you for the replies. I had actually tried the clear:both; method prior to posting here and it didn't seem to make a difference.

Darocha: That worked great. I would have never thought of that. It worked in IE7, Firefox, Opera and Safari. The only browser it didn't work in was IE6. It aligns the site all the way to the right. I had to use a hack, unfortunately, but was able to get it to work in IE6 as well.

Thanks again,
__________________
Jeff T. Severson
J.T.S. Design, Inc.
Reply With Quote
Reply

  WebProWorld > Site Design > Graphics & Design Discussion Forum

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does anyone like this layout? gerardkelley Submit Your Site For Review 19 05-04-2007 10:42 AM
CSS Layout richkoi Graphics & Design Discussion Forum 4 10-20-2005 11:45 AM
CSS layout web-content-king Graphics & Design Discussion Forum 7 03-14-2005 11:33 AM
Web Layout WPW_Feedbot Graphics & Design Discussion Forum 0 02-08-2005 02:30 AM
New layout? ergobob Graphics & Design Discussion Forum 3 08-30-2004 08:24 AM


All times are GMT -4. The time now is 06:59 PM.



Search Engine Optimization by vBSEO 3.3.0