Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Dec 2010
    Posts
    2
    Member #
    25402
    Hey everyone,

    I'm new to HTML and CSS and have been trawling the web for answers to my predicament.

    So now I'm here because I need some help.

    Basically the problem is that I have a three column website using CSS and HTML but the third column (called #sidebar2) is at the bottom of the page, while .text (middle column) and #sidebar1 (left column) are aligned. I want them all to be aligned. The header and menu are fine. Can anyone please make some suggestions?

    Best and thanks in advance,

    AF.

    Here is the truncated version of the HTML --

    <div id="wrapper">

    <div id="header">
    <img src="headersurreal.jpg" width="1100" height="220" alt="XX"/>
    </div>

    <div id="menu">
    <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">Artists</a></li>
    <li><a href="#">Links</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Writing</a></li>
    </ul>
    </div>


    <div id="content">

    <div id="sidebar1">
    <h1>Artists</h1>
    <ul>
    <li><a href="#">Bat For Lashes</a></li>
    <li><a href="#">Beach House</a></li>
    <li><a href="#">Foals</a></li>
    <li><a href="#">Warpaint</a></li>
    </ul>
    </div>

    <div class="text">

    <h1>On music</h1>

    <p>dddadad<p>

    </div>

    <div id="sidebar2">
    <img src="listeningtomusic.jpg" width="267" height="400" alt="Woman listening to music in a forest"/>
    </div>

    <div class="footer">
    <p>&copy; mmm (except image) 2010</p>
    </div>

    </div>

    </body>
    </html>

    And here is the CSS in an external sheet:

    @charset "utf-8";
    /* CSS Document */

    * {margin:0px; padding:0px;}

    html {
    background-color:#a9d3da;
    margin:10px;
    }

    #wrapper {
    background-color:#FFFFFF;
    width:1100px;
    margin-left:auto;
    margin-right:auto;
    padding:10px;
    /* Centering for IE6+ in strict mode,
    Firefox, and other modern browsers */
    /* Don't center every line of text -
    we inherited this setting from body */
    text-align: left;
    }

    #header {
    position:relative;
    width:1100px;
    height:220px;
    border:#000 solid 1px;
    }

    #menu {
    position: relative;
    width: 1100px;
    bottom: 0px;
    height: 40px;
    left: 0px;
    background-color: #a9d3da;
    }

    #menu ul {
    list-style:none;
    }

    #menu li {
    display:inline;
    font-size:18px;
    width:200px;
    padding:0px;
    text-align:center;
    }

    #menu a {
    color:#000000;
    text-decoration:none;
    line-height:30px;
    display:block;
    width:200px;
    display:inline-block;
    text-align:center;
    }

    #menu a:hover {
    background-color:#c5c9ca;
    }

    body {
    font-family:Arial, Helvetica, sans-serif;
    font-size:14px;
    color:#333;
    }

    #content {
    width:100%;
    border:#F00 solid 1px;
    }

    h1 {
    font-family:Georgia, "Times New Roman", Times, serif;
    font-size:20px;
    color:#0C0;
    text-align:center;
    }

    #sidebar1 {
    font-family: Arial, Helvetica, sans-serif;
    width: 12%;
    float:left;
    font-size: 14px;
    list-style-type:none;
    padding:10px;
    background-color: #FFFFFF;
    border:#0F0 solid 1px;
    }

    .text {
    width:50%;
    overflow:hidden;
    padding: 10px;
    border:#F90 solid 1px;
    }

    #sidebar2 {
    float:right;
    top:10px;
    width:30%;
    border:#0F0 solid 1px;
    background-color: #FFFFFF;
    overflow:hidden;
    }

    .footer {
    width:1100px;
    padding-top: 20px;
    text-align: center;
    background-color: #a9d3da;
    clear:both;
    }

  2.  

  3. #2
    WDF Staff AlphaMare's Avatar
    Join Date
    Oct 2009
    Location
    Montreal, Canada
    Posts
    4,570
    Member #
    20277
    Liked
    878 times
    check your divs

    I looked at your HTML and noticed right away that your "content" and your "menu" divs are not closed.

    It is a good idea to comment your code as you write it - for example, if I create a <div> I always immediately create the close </div> and comment the close <!-- close divname --> so that later, if the close gets pushed down the page, I can find it. This is particularly important when using nested divs.

    Also - for a three-column layout, see this explanation - it takes you through it step by step, explaining why things work the way they do..

    Hope this helps,
    Good design should never say "Look at me!"
    It should say "Look at this." ~ David Craib


    http://digitalinsite.ca ~ my current site . . info@digitalinsite.ca ~ my email

    If you feel that someone's post helped you fix your problem, answered your question, or just made you feel better, feel free to "Like" their post. The "Like" link is at the bottom right of each post, along side the "reply" link. And if you are being helped here, try to help someone else - pass it on!

  4. #3
    Senior Member Dorky's Avatar
    Join Date
    Jun 2009
    Location
    Destin Florida
    Posts
    1,430
    Member #
    19103
    Liked
    4 times
    Code:
    	#sidebar1 {
            display: block;
            float:left;
    	width: 12%;
    	font-size: 14px;
    	list-style-type:none;
    	padding:10px;
    	background-color: #FFFFFF;
    	border:#0F0 solid 1px;
            font-family: Arial, Helvetica, sans-serif;
    	}
     
    	.text {
            display: block;
            float:left;
    	width:auto;
    	overflow:auto;
    	padding: 10px;
    	border:#F90 solid 1px;
    	}
     
    	#sidebar2 {
            display: block;
    	float:left;
    	top:10px;
    	width:30%;
    	border:#0F0 solid 1px;
    	background-color: #FFFFFF;
    	overflow:auto;
    	}
    set the overflow to auto. this+declaring width prevents the margin collapse caused when floating elements.

    while($get_it !== true){ continue; }

  5. #4
    Junior Member
    Join Date
    Dec 2010
    Posts
    2
    Member #
    25402
    Thank you.

    Thank you to both but a little bit more to Dorky...y:-Dour suggestion worked!

    Best to you both.

  6. #5
    Senior Member Dorky's Avatar
    Join Date
    Jun 2009
    Location
    Destin Florida
    Posts
    1,430
    Member #
    19103
    Liked
    4 times
    glad to help. remember to give back to the forum as you learn.

    while($get_it !== true){ continue; }


Remove Ads

Posting Permissions

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

Search tags for this page

right align 3rd column css html

Click on a term to search for related topics.
All times are GMT -6. The time now is 12:38 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com