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 5 of 5
  1. #1
    New Coder
    Join Date
    Oct 2011
    Location
    Portsmouth, United Kingdom
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Alignment Problems CSS

    Hey,

    I am having a fair few problems with designing my website. Firstly, when minimizing the window and narrowing it, the text mucks up and looks messy i.e. pushes everything down the page vertically and doesn't stay consistent?

    Also for my header image, it changes with the size of the screen and shortens on larger screens..

    Finally, I've used a wrapper with 20% margin-right and margin-left for the whole body, is there anyway to do this for the navigation links, as they are not exactly aligned in the center?

    Header code:
    Code:
    #header {
     background-image: url(images/island.jpg);
     width: 75%;
     height: 200px;
     background-repeat:no-repeat;
     background-size: 1000px 300px;
    }

    Wrapper Code:
    Code:
    #wrapper { 
     margin-right: 20%;
     margin-left: 20%;
     margin-top: 2%;
     margin-bottom: 2%;
     width: 75%;
    }
    Navigation code:
    Code:
    #nav {
     float: left;
     width: 75%;
     height: 50px;
     text-align: center;
     background: #FFFF00;
     color: #0000CC;
     font-family: Arial, Helvetica, sans-serif;
     font-size: 1em;
     font-weight: bold;
    } 
    
    #nav ol a:visited {
    	color: #6633FF; 
    }
    #nav ol a:active {
    	color: #FFFFFF;
    	background-color: #FF00CC; 
    }
    #nav ol a:hover {
    	color: #FFFFFF;
    	background-color: #00FFFF; 
    }
    Many Thanks

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello thunder_light,
    A percentage layout that works well can mess up as soon as some fixed pixel width content does not scale with the rest of the site.

    In the bit of CSS you posted here, it seems a little odd that #wrapper would be 75% with 20% right/left margins. 75 plus 20 plus 20 = 115% width?

    See the box model here. The box model says that whatever you put inside an element cannot be larger than that element. margin/padding/border all count when figuring width/height.

    A link to the test site would help, that way we can see what's happening.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • Users who have thanked Excavator for this post:

    thunder_light (11-20-2011)

  • #3
    New Coder
    Join Date
    Oct 2011
    Location
    Portsmouth, United Kingdom
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thank you very much, I totally forgot about the box model! Sorry about that!
    Okay, I may sound really silly, but I'm creating my website in Aptana and the links in the URL is from my drive (file:///J:/Design%20for%20the%20Internet/Website%20New/history.html) so how do I link this to you? I'm a newbie as you may have already guessed

  • #4
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    You're not going to be able to link to a file on your hard drive. You need to upload it to a server - some free hosting here.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #5
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks excavator your free hosting link is quite valuable. Thanks again to sharing free hosting link


  •  

    Posting Permissions

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