Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

divide the page in three parts using div tag

Tags:

html

layout

I am trying to get the below layout for more than 1.5 hours but still can't get the right solution.

well if there are any duplicates then forgivve me for asking this question.

I want to have a layout like below diagram using div tag:

|_________________________________________________________________________________ |                                            |                                                                                                                     | |                                            |                                                                                                                     | |                                            |                                                                                                                     | |                                            |                                                                                                                     | |                                            |__________________________________________________________ |                                            |                                                                                                                     | |                                            |                                                                                                                     | |                                            |                                                                                                                     | |                                            |                                                                                                                     | |                                            |                                                                                                                     | |                                            |                                                                                                                     | |                                            |                                                                                                                     | |                                            |                                                                                                                     | |__________________________________________________________________________________

I know how to do it using table tag.

like image 896
Khushi Avatar asked Dec 16 '22 08:12

Khushi


2 Answers

float:left is your friend

HTML:

<div id="wrapper">
    <div id="first"></div>
    <div id="second"></div>
    <div id="third"></div>
</div>

The CSS:

div {
    display: block;
}
#wrapper {
    width: 400px;
    height:400px;
}

#first {
    float:left;
    width: 33%;
    height: 100%;
    background: red;
}

#second {
    float:left;
    width: 67%;
    height: 30%;
    background: green;
}

#third {
    float:left;
    width: 67%;
    height: 70%;
    background: blue;
}

Example: http://jsfiddle.net/Vkmq3/1/

like image 138
Arda Avatar answered Jan 08 '23 13:01

Arda


Here is exact JSFiddle or JSBin

Make CSS as

#upleft { 
   width:100px; 
   height: 300px; 
   background:red; float:left; 
}

#upright { 
   width:300px; 
   height:200px; 
   background:blue; 
   float:left
}
#below { 
   height:300px; 
   width:400px; 
   background:green 
}

And in HTML

<div id="upleft"></div>
<div id="upright"></div>
<div id="below"></div>
like image 31
Naveen Kumar Alone Avatar answered Jan 08 '23 14:01

Naveen Kumar Alone