Difference between revisions of "More div"

From MyWiki
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 26: Line 26:
 
</source>
 
</source>
  
float:left is your friend<br
+
float:left is your friend,  HTML:<br
 +
 
  
HTML:
 
  
 
<source lang="html4strict">
 
<source lang="html4strict">
Line 68: Line 68:
 
     background: blue;
 
     background: blue;
 
}
 
}
 +
</source>
 +
 +
 +
 +
Try this css and html code:CSS:<br>
 +
<source lang="html4strict">
 +
<style type="text/css">
 +
#left {
 +
  float:left;
 +
  width:27%;
 +
  height: 25em;
 +
  margin:1px .2em 1px 1px;
 +
  border: 2px solid green;
 +
}
 +
#content {
 +
  margin:1px .2em 1px 28%;
 +
}
 +
#cnt1 {
 +
  position;relative;
 +
  margin:.3em 2px;
 +
  height: 10em;
 +
  border: 1px solid blue;
 +
}
 +
#cnt2 {
 +
  position;relative;
 +
  margin:.3em 2px;
 +
  height: 100%;
 +
}
 +
</style>
 +
</source>
 +
HTML:
 +
<source lang="html4strict">
 +
<div id="left">Left side</div>
 +
<div id="content">
 +
  <div id="cnt1">Up</div>
 +
  <div id="cnt2">Down</div>
 +
</div>
 +
<br style="clear:both;" />
 
</source>
 
</source>

Latest revision as of 12:06, 12 June 2014

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>

float:left is your friend, HTML:<br


<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: 750%;
    background: blue;
}


Try this css and html code:CSS:

<style type="text/css">
#left {
  float:left;
  width:27%;
  height: 25em;
  margin:1px .2em 1px 1px;
  border: 2px solid green;
}
#content {
  margin:1px .2em 1px 28%;
}
#cnt1 {
  position;relative;
  margin:.3em 2px;
  height: 10em;
  border: 1px solid blue;
}
#cnt2 {
  position;relative;
  margin:.3em 2px;
  height: 100%;
}
</style>

HTML:

<div id="left">Left side</div>
<div id="content">
  <div id="cnt1">Up</div>
  <div id="cnt2">Down</div>
</div>
<br style="clear:both;" />