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 12-05-2012, 06:51 PM   PM User | #1
Bob8
New Coder

 
Join Date: Jul 2011
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Bob8 is an unknown quantity at this point
Divs go to the left below each other

I try to make a container of 1140 px and center it. Then in this container I try to place images next to each other. The strange thing is that both images (and the container as well I think) are aligned left, and below each other.
I did try to put it inline and fload to the left, but it appears not to be working...

Code:
<body class="centerAll">
<div id="box1">
<div id="logos"></div>
<div id="logo"></div>
</div>
Code:
.centerAll {
	text-align: center;
}
#box1{
	margin-top: 200px;
	width: 1140px;
	height: 275px;
	margin-bottom: 15px;
}
#logos{
	width: 555px;
	height: 275px;
	background-image: url('img/one.png');
	background-repeat: no-repeat; 
	background-position: top;
	
}
#logo{
	width: 165px;
	height: 275px;
	background-image: url('img/two.png');
	background-repeat: no-repeat; 
	background-position: top;
	display:inline-block;
	float:left;
	margin-left: 20px;
}
Bob8 is offline   Reply With Quote
Old 12-05-2012, 07:26 PM   PM User | #2
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
I think you need to look at and understand the box model and then Block vs Inline elements and how they behave. You have two block levels there which would stack on each other, and then one being floated. What you need to do is float all three. A quick google on 3 column div layout will get you a ton of results... here's one.

Try running through some online tutorials as well as they will teach you a great deal.
__________________

I code C hash-tag .Net
Reference: W3C W3CWiki .Net Lib
Validate: html CSS
Debug: Chrome FireFox IE
alykins is offline   Reply With Quote
Reply

Bookmarks

Tags
css, float

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 10:15 AM.


Advertisement
Log in to turn off these ads.