Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-16-2010, 12:54 PM   PM User | #1
EnfantSauvage
New to the CF scene

 
Join Date: Nov 2010
Posts: 6
Thanks: 2
Thanked 0 Times in 0 Posts
EnfantSauvage is an unknown quantity at this point
Problem with bottom margin

I am building a web site where i have two inside wrappers centered on screen using an outside wrapper that has margin left/right auto.
The structure looks like this

Code:
<body>

<div id="outside_wrapper">

<div id="inside_wrapper"></div>
<div id="sidebar"></div>

</div>

</body>

#outside_wrapper {
	width: 993px;
	margin: 25px auto;
}

#inside_wrapper {
	width: 823px;
	height: auto;
	float: left;
}

#sidebar {
	height: auto;
	width: 155px;
	margin-top: 224px;
	float: left;
	margin-left: 7px;
}
I am successful in centering the inside_wrapper and the sidebar with the invisible outside_wrapper but I also want to have a bottom and top margin of 25 px.
And now the problem - the top margin works without any problem on any browser, but the bottom margin only works with Firefox. All the other browsers (IE 8 and 9beta, Chrome, Safari, Opera) do not recognize the bottom margin.

I managed to get a bottom margin by giving a concrete height to the outside_wrapper instead of auto but that solution is no good for me since I am building a dynamic gallery and the inside_wrapper changes height depending on the image opened inside it.
Does someone know of a solution to this problem?
EnfantSauvage is offline   Reply With Quote
Old 11-16-2010, 01:12 PM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
The structure looks like this
Can we have a link to your page? Or please post your complete HTML (including DOCTYPE)+CSS
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 11-16-2010, 01:16 PM   PM User | #3
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
Hello EnfantSauvage,
You need to clear your floats.
Add overflow:auto; to your #outside_wrapper. Have a look at this page to see how that works.

Code:
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
#outside_wrapper {
	width: 993px;
	margin: 25px auto;
	overflow: auto;
	background: #ff0; /*for demonstration only*/
}
#inside_wrapper {
	width: 823px;
	float: left;
	background: #00f;
}
#sidebar {
	margin: 225px 0 0 830px;
	background: #f00;
}
</style>
</head>
<body>
    <div id="outside_wrapper">
        <div id="inside_wrapper">some site goes here</div>
        <div id="sidebar">some menu goes here</div>
    </div>
</body>
</html>
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

Last edited by Excavator; 11-16-2010 at 01:21 PM..
Excavator is offline   Reply With Quote
Users who have thanked Excavator for this post:
EnfantSauvage (11-16-2010)
Old 11-16-2010, 01:25 PM   PM User | #4
EnfantSauvage
New to the CF scene

 
Join Date: Nov 2010
Posts: 6
Thanks: 2
Thanked 0 Times in 0 Posts
EnfantSauvage is an unknown quantity at this point
Quote:
Originally Posted by Excavator View Post
Hello EnfantSauvage,
You need to clear your floats.
Add overflow:auto; to your #outside_wrapper. Have a look at this page to see how that works.
Thank you very much, that solved my problem.
EnfantSauvage is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 03:28 AM.


Advertisement
Log in to turn off these ads.