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 to the CF scene
    Join Date
    Jun 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DIV and list help

    Hi

    I am redesigning a family holiday website of mine http://www.cornwallholidayhome.com/2012site/ but it has been a couple of years since I did any proper CSS coding so I am a bit rusty.

    The site has 3 columns and there are 2 navigation bars (which I used from a template site) which are inside a wrapper. The top is called navtop and the bottom one is called navbottom. After I added placeholder text to the centre column I added the bottom navigation bar however it postioned itself at the bottom of the wrapper but the background colour merged upwards.

    Also if I write in the centre column and it reached the bottom the DIV's merge together (the background colour of the bottom nav bar pushed upwards). As long as the text does not reach the bottom of the centre DIV then it is ok. I tried playing about with the code but the only way I could get the bottom nav bar to load correctly was to set the top margin at 705px which is what is set currently however as you can see the issue with the DIV's merging still occurs. It looks as though it is inheriting another attribute but I cannot work out what. The bottom nav bar should look like this - http://i.imgur.com/SpLj9.jpg

    Is there a better way to set the bottom nav bar in the correct place and if so will it prevent the problem with the DIV's merging? (i.e if I type beyond the bottom of the centre column it will push the bottom nav bar and the bottom wrapper downwards

    The website is http://www.cornwallholidayhome.com/2012site/index.html and the CSS is at http://www.cornwallholidayhome.com/2...s/css/main.css

    Thanks for any assistance
    -Jim

  • #2
    New Coder
    Join Date
    May 2012
    Location
    Oregon, USA
    Posts
    19
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Honestly your code is a mess. You've got tags opening and closing in wrong places. Your CSS has some weird stuff going on too. I'm amazed the page looks as good as it does.

    I'd suggest you start by validating and correcting the pages.

    HTML: Found 11 errors
    http://validator.w3.org/#validate_by_upload

    CSS: Found 2 errors
    http://jigsaw.w3.org/css-validator/#validate_by_upload

    Ultimately I believe your issue is with relative and absolute positioning. It appears your navigation area is intended to be absolute, but you don't have a positioning tag in your CSS for navbottom. If you add a 100% height to your contentwrapper you'll see the navigation blow up due to a margin-top of 751px.

  • #3
    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 bart,
    Look how easy you can make it without using negative margins, floating full width elements.

    Your document will expand to contain what you put in it if you do not specify a height, assuming you've cleared your floats.

    This might help you get started with your re-write. You'll still need to adjust some widths and add your borders... to do that, you will need to be familiar with the box model.
    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.

    Code:
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Untitled Document</title>
    <style type="text/css">
    html, body {
    	margin: 0;
    	background: #fc6;
    	font: 100% Arial, Helvetica, sans-serif;
    }
    #container {
    	width: 950px;
    	margin: 30px auto;
    	background: #fff;
    	overflow: auto;
    	box-shadow: 0 0 20px #8493A6;
    }
    nav {
    	height: 40px;
    	width: 940px;
    	margin: 0 auto;
    	background: #333;
    }
    #headerimage {
    	margin: 15px auto;
    	padding: 15px;
    	display: block;
    	box-shadow:0px 0px 4px #333333
    }
    #left, #right, #center {padding: 25px;}
    	#left {
    		width: 250px;
    		float: left;
    	}
    	#right {
    		width: 100px;
    		float: right;
    	}
    	#center {
    		margin: 0 150px 0 300px;
    	}
    </style>
    </head>
    <body>
    	<div id="container">
        	<img src="http://www.cornwallholidayhome.com/2012site/elements/css/bannertop.jpg" alt="holiday home" width="800" height="325" id="headerimage">
            	<nav></nav>
        <div id="left">left column</div>
            <div id="right">right column</div>
                <div id="center">
                    <p>
                        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna 
                            <br /><br />
                        aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no 
                            <br /><br />
                        sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam 
                            <br /><br />
                        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo 
                            <br /><br />
                        duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
                    </p>
                    <p>
                        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna 
                            <br /><br />
                        aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no 
                            <br /><br />
                        sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam 
                            <br /><br />
                        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo 
                            <br /><br />
                        duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
                    </p>
                <!--end center--></div>
            <nav></nav>
        <!--end container--></div>
    </body>
    </html>
    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

  • #4
    New to the CF scene
    Join Date
    Jun 2012
    Location
    Portland, OR
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Some Follow Up Help

    Hi Bart,

    Some really great advise from Excavator here! Once you get this sorted, you may want to bookmark a resource like CSSReset. Really good free tutorials and help available there for users of all levels, even folks who rarely need to touch any code.

  • #5
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you for all the help especially Excavator as your code was perfect! I have used your template and it works great floating the columns.


  •  

    Posting Permissions

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