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 3 of 3
  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    1
    Member #
    37976

    best way to center website?

    Pretty new to css and html
    drubiano.github.io/



    Edit*:

    messed around with it some more

    Code:
    body{
    margin-bottom: 120px;
    background-image: url("spacebg.jpg");
    }
    
    .content {
    float: right;
    height:100%;
    background-color: #B8C5D1;
    color: black;
    width: 600px;
    }
    
    .content h1 {
    text-align:center;
    }
    
    nav {
    height:100%;
    text-align: center;
    float: left;
    width: 200px;
    list-style-type:none;
    background-color: #404853;
    }
    
    nav li a {
    color: #fff;
    text-decoration: none;
    }
    nav li a:hover
    {
    background-color: #369;
    color: #fff;
    }
    
    .container {
    width:800px;
    margin:auto;
    }
    I cant make the height: 100% work so backgrounds fill in all the way down the page
    Last edited by tribal; Dec 16th, 2013 at 05:23 PM.

  2.  

  3. #2
    Junior Member Al-Toid's Avatar
    Join Date
    Jan 2014
    Posts
    11
    Member #
    38135
    container {
    height:auto;
    margin:6px auto;
    position:relative;
    }

    Will center your page.

  4. #3
    Junior Member
    Join Date
    Jan 2014
    Posts
    5
    Member #
    38175
    To make your layout center horizontally, use margin-left:auto; margin-right:auto;

    To center it vertically, use position absolute and top:50%; bottom:50%;

    Good luck


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 09:44 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com