Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Posts
    151
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Basic CSS (divs side-by-side) Question

    How do I (with this code below) get the div elements to sit side by side, forming a 3-column layout. I know there are plenty of tuts around and examples of how to do a 3 column layout but i am learning the basics and would appreciate it if someone could point out the simplest way to do this seemingly basic task?





    Code below

    Code:
    <html>
    <head>
    	<title>CSS Test</title>
    <style>
    .1{
    	border: 1px solid #FF6666;
    	background-color: #FFCCCC;
    	height: 30px;
    	width: 190px;
    }
    .2{
    	border: 1px solid #FF6666;
    	background-color: #FFCCCC;
    	height: 30px;
    	width: 100%;
    }
    .3{
    	border: 1px solid #FF6666;
    	background-color: #FFCCCC;
    	height: 30px;
    	width: 190px;
    }
    </style>	
    </head>
    <body>
    
    <div class="1">
    1
    </div>
    
    <div class="2">
    2
    </div>
    
    <div class="3">
    3
    </div>
    
    </body>
    </html>

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    United Kingdom Confused: Often
    Posts
    859
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <div>'s are block elements... meaning they aint gonna just line up unless you tell them to...

    i know you asked for a solution to your problem rather than a link but taking a look around www.glish.com/css should help you understand about using <div>'s in place of <table>'s.
    Last edited by redhead; 12-23-2002 at 03:27 PM.
    redhead

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Location
    Raleigh, NC
    Posts
    484
    Thanks
    0
    Thanked 0 Times in 0 Posts
    here are two good links that give several examples and code for this...

    http://www.thenoodleincident.com/tut...son/boxes.html

    http://glish.com/css (examples in top right corner)
    -WebMark Art
    Programming is 80% thinking and 20% spelling

  • #4
    Regular Coder
    Join Date
    Aug 2002
    Posts
    151
    Thanks
    0
    Thanked 0 Times in 0 Posts
    o.k I'll take a look


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •