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 08-02-2011, 01:21 AM   PM User | #1
Radovan
New Coder

 
Join Date: May 2011
Posts: 20
Thanks: 3
Thanked 0 Times in 0 Posts
Radovan is an unknown quantity at this point
relative positioning

Hello,

I want to make this layout:



There are 4 relative positioned divs next to each other in some container.

The red line in my picture shows where the container's height should end but it doesn't because of the last div which default position is down there. I can't set fixed height for container because of random stuff above.

How to do it?
Radovan is offline   Reply With Quote
Old 08-02-2011, 07:59 AM   PM User | #2
vikram1vicky
Regular Coder

 
Join Date: Jul 2011
Location: India
Posts: 496
Thanks: 3
Thanked 57 Times in 56 Posts
vikram1vicky is an unknown quantity at this point
Share mockup of layout you want and your present code in which you have issue...
vikram1vicky is offline   Reply With Quote
Old 08-02-2011, 11:47 AM   PM User | #3
Radovan
New Coder

 
Join Date: May 2011
Posts: 20
Thanks: 3
Thanked 0 Times in 0 Posts
Radovan is an unknown quantity at this point
I don't think it's important, but if you need it anyway ...

CSS
Code:
#container
{
width:600px;
background:blue;
margin:0 auto;
}

.box
{
float:left;
width:196px;
height:318px;
background:red;
}

#box1
{
position:relative;
left:-140px;
float:left;
}

#box2
{
position:relative;
left:-102px;
}

#box3
{
position:relative;
left:-66px;
}

#box4 //this div is doing the mess because it's default position is under the other 3 divs and that's why the container stretches.
{
position:relative;
left:558px;
top:-318px;
}
HTML
Code:
<div id="container">

<div>RANDOM CONTENT</div>

<div class="box" id="box1"></div>
<div class="box" id="box2"></div>
<div class="box" id="box3"></div>
<div class="box" id="box4"></div>

<div style="clear:both"></div>
</div>

Last edited by Radovan; 08-02-2011 at 11:51 AM..
Radovan 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 06:52 PM.


Advertisement
Log in to turn off these ads.