Monday, 6 January 2014

Arranging DIVs Horizontally

1 comment
Working with DIV tag is always problem and hard work thats why many web developers avoid creating their websites in DIV tag, in this tutorial, I will show you how to arrange DIVs in horizontal order with CSS.

The HTML Code


This is the html code for 4 divs div.container, div.left, div.middle and div.right.
Note: Below the div.right there is another div with height:0; and width:100% and clear:both, the job of this div is to make sure the floating divs not going outside the container, try on your own to remove the div.clear to see what will happen on those floating div.


   <div class="container">
   <div class="left">Left</div>
   <div class="middle">Middle</div>
   <div class="right">Right</div>
   <div class="clear"></div>
   </div>



The CSS Code


.container{
width:600px;
padding:0;
border:5px solid #ddd;
margin:0 auto;
}

.left{
float:left;
width:150px;
height:300px;
text-align:center;
background:#4b471a;
font:18px Arial, Helvetica, sans-serif;
font-weight:bold;
color:#1b1b1b;
}

.middle{
float:left;
width:300px;
height:300px;
text-align:center;
background:#a19c5a;
font:18px Arial, Helvetica, sans-serif;
font-weight:bold;
color:#1b1b1b;
}

.right{
float:left;
width:150px;
height:300px;
text-align:center;
background:#4b471a;
font:18px Arial, Helvetica, sans-serif;
font-weight:bold;
color:#1b1b1b;
}

.clear{
clear:both;
height:0;
width:100%;
}

Output



By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

1 comment:

  1. dear ulerxonoate, "sham" is actually my name..if you want output example...feel free to try by ur self..=)

    ReplyDelete

Subscribe to our newsletter to get the latest updates to your inbox.

Your email address is safe with us!




Founder of developersnote.com, love programming and help others people. Work as Software Developer. Graduated from UiTM and continue study in Software Engineering at UTMSpace. Follow him on Twitter , or Facebook or .



Powered by Blogger.