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 4 of 4
  1. #1
    Senior Member whippetkid's Avatar
    Join Date
    May 2010
    Location
    Scotland
    Posts
    123
    Member #
    22044
    Hi

    With help I managed to overcome one div problem yesterday, now I have one last problem which I hope is easily fixed. I am trying to create a container div around my main content to centre whatever content I am going to put within...how do I do this without starting again?

    Here is the code:

    ***STYLE.CSS***

    Code:
    body
    {
        colour: #EAE8F5;
        margin: 0 auto;
        padding: 0;
    
    }
    ul
    {
    margin:0;
    padding:0;
    float:left;
    }
    li
    {
    list-style-type:none;
    margin:0;
    padding:0;
    float:left
    }
    
    a:link,a:visited
    {
    display:block;
    width: px;
    font: Georgia, Verdana, sans-serif;
    font-size: 14px;
    color:#5A205A;
    background-color: none;
    text-align:center;
    padding: 20px;
    text-decoration:none;
    }
    a:hover,a:active
    {
    display:block;
    width: px;
    font:: Georgia, Verdana, sans-serif;
    font-size: 14px;
    color:#878787;
    background-color: none;
    text-align:center;
    padding: 20px;
    text-decoration:none;
    }
    
    #shadow {
        background-color: #fff;
        width: 940px;
        margin-right: auto;
        margin-left: auto;
    
    }
    #wrapper {
        background-color: #fff;
        width: 850px;
        margin-top: 0px;
        margin-right: auto;
        margin-bottom: 0px;
        text-align: left;
        position: relative;
        margin-left: auto;
        background:#CCCCCC;
    }
    #header {
        width: 850px;
        background-color: #fff;
        position: relative;
        margin-top: 100px;
        text-align: center;
        margin-bottom: -50px;
    }
    #transparency {
        /* background-color: rgba(100,149,237, 0.0);*/
        width: 324px;
        height: 100;
        position: absolute;
        font-size: xx-large;
        text-align: right;
        /*    top: 160px;
        left: 435px;*/
        color: #EAE8F5;
        top: -550px;
        left: 75px;
    }
    #maincontent {
        height: 300px;
        width: 850px;
        background-color: #EAE8F5;
        floadt: left;
        padding-top: 10px;
        font-size: xx-large;
    }
    #footer {
        height: 200px;
        background-color: #F00;
    }
    #form {
        /* height: 600px;*/
       height:inherit;
        width: 850px;
        float:left;
    }
    body
    {
    text-align: center
    }
    
    #content
    {
    text-align: left;
    width: 700px;
    
    margin: 0 auto
    }


    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    THANKYOU!!

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,485
    Member #
    425
    Liked
    2783 times
    Your #wrapper div would do that if you changed "text-align: left;" to "text-align: center;". You'd have to add another div inside of the wrapper to left-justify the text if you need it left-justified, but it will work.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  4. #3
    Senior Member whippetkid's Avatar
    Join Date
    May 2010
    Location
    Scotland
    Posts
    123
    Member #
    22044
    Thanks, I will try that and tighten things up!

  5. #4
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Try this:
    I assume #wrapper is the div you're talking about. Add this to the style for it:

    #wrapper{
    left:50%;
    margin-left:-425px;
    position: relative;
    }
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."


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
  •  
All times are GMT -6. The time now is 05:28 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com