logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > HTML and CSS
Register FAQ Members List Search Today's Posts Mark Forums Read

Closed Thread
 
Thread Tools Display Modes
Old 12-04-2009, 05:36 PM   #1
alihandford
 
Join Date: Dec 2009
Posts: 8
Default Lining up divs

I want all my divs to be lined up like -
x x x

Two of them do this, but the other doesn't how do I fix this?

Here is my code
Code:
<style type="text/css">
<!--
#apDiv1 {
	position:relative;
	width:200px;
	height:115px;
	z-index:1;
	float:left;
	background-color:#000000;
	color:#FFFFFF;
	
	
}
#apDiv2 {
	position:relative;
	width:200px;
	height:115px;
	z-index:2;
	margin-left:200px;
	background-color:#000000;
	color:#FFFFFF;
	
}
#apDiv3 {
	position:relative;
	width:200px;
	height:115px;
	z-index:3;
	float:right;
	background-color:#000000;
	color:#FFFFFF;
	
}
-->
</style>
<div id="apDiv1">hello</div>
<div id="apDiv2">bye</div>
<div id="apDiv3">lol</div>
My second question is, I want padding around the divs but when I do this, through css, the padding is black because my background is black. Is there a way of making the padding white and still keeping the background of the div black?
alihandford is offline  
Old 12-04-2009, 05:45 PM   #2
domedia
Administrator
domedia's Avatar
 
Join Date: Dec 2003
Posts: 9,710
Default

Quote:
Originally Posted by alihandford View Post
I want all my divs to be lined up like -
x x x
Then don't use absolutely positioned DIV's. They are not meant for layout.
Quote:
Originally Posted by alihandford View Post
My second question is, I want padding around the divs but when I do this, through css, the padding is black because my background is black. Is there a way of making the padding white and still keeping the background of the div black?
No, padding is outside the content area and is going to use the background of it's own element. So you have to find another way of doing it. Do you have a link?
domedia is offline  
Old 12-04-2009, 05:47 PM   #3
alihandford
 
Join Date: Dec 2009
Posts: 8
Default

The link is http://www.lannia.com/inspiration/

What divs should I use?
alihandford is offline  
Old 12-04-2009, 05:54 PM   #4
gentleone
gentleone's Avatar
 
Join Date: Nov 2009
Location: Rhodes, Greece
Posts: 2,837
Default

Code:
What divs should I use?
Div tags and position them purely with floats.
gentleone is offline  
Old 12-04-2009, 06:03 PM   #5
domedia
Administrator
domedia's Avatar
 
Join Date: Dec 2003
Posts: 9,710
Default

Quote:
Originally Posted by alihandford View Post
What divs should I use?
<div> and make sure you don't use absolute positioning.
domedia is offline  
Old 12-04-2009, 06:07 PM   #6
alihandford
 
Join Date: Dec 2009
Posts: 8
Default

^ Can you give me an example please? Because I'm going to want more than one div like -

x x x x

but I don't know how to do this?

Last edited by alihandford; 12-04-2009 at 06:20 PM..
alihandford is offline  
Old 12-04-2009, 07:06 PM   #7
gentleone
gentleone's Avatar
 
Join Date: Nov 2009
Location: Rhodes, Greece
Posts: 2,837
Default

HTML Code:
<div class="wrapper">
  <div class="col1">hello</div>
  <div class="col1">bye</div>
  <div class="col1">lol</div>
  <div class="col2">fun</div>
</div>
CSS
Code:
.col1 {float:left}
.col2 {float:right}
.col1, .col2 {width:200px;height:115px;background-color:#000000;color:#FFFFFF}
gentleone is offline  
Closed Thread


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

Forum Jump


All times are GMT. The time now is 01:00 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com