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
    Mar 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Navigation on top of image. Need help

    hello, i am having incredible amounts of trouble regarding placement of navigation.

    It is not the same form as placement as it is in its own div with an image.
    I want it to be on my image, which is a logo as well as the home icon.
    How do you get the navigation on-top of the image and within the div?

    Html looks like this:
    Code:
    <div id="nav">
           	  <h1><a href="#">Kyle</a></h1>
    		  <ul>
           			<li><a href="#">Portfolio</a></li>
                	<li><a href="#">About me</a></li>
                	<li><a href="#">Resume</a></li>
                	<li><a href="#">Contact</a></li>
              	</ul>
            </div>       
    	</div>
    
    Css :
    
    #nav h1{
    	background-image:url(../images/header_logo.png);
    	height:146px;
    	text-indent:-9999;
    	background-repeat:no-repeat;
    }
    #nav a {
    	display: inline-block;
    	width: 75px;
    	text-indent: -9999px;/* gets rid of wording */	
    }
    li{
    	float: left;
    	margin: 0 auto;
    }
    a{
    	text-decoration: none;
    	margin-left: 20px;	
    }

  • #2
    New Coder
    Join Date
    Jun 2012
    Posts
    57
    Thanks
    13
    Thanked 0 Times in 0 Posts
    Well I'm not sure about what exactly the problem is (I don't see an image tag in your code).

    But i did notice that there was only one opening div tag and 2 closing ones. Maybe that is an error?

    Edit: Wait, I see where the image comes from
    Last edited by zingzing45; 03-28-2013 at 09:06 PM. Reason: Overlooked code

  • #3
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I spent over 6 hours trying to figure it out, and i need to figure it out in order to have it finished before friday night. Scripting is absolutely horrible.

  • #4
    New Coder
    Join Date
    Jun 2012
    Posts
    57
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Cool

    Hmm... so you are trying to get all the things on top of each other?
    If you do not see any other solution, use absolute positioning and z-score (or whatever its called (layering stuff)) to put stuff where you want it. Its not the best way, but it works when you need it, I suppose.

  • #5
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,667
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello kylebear,
    It always helps to validate. You have an extra </div> closing tag, your text-indent: 9999; means nothing without a px, em or some other sort of measurement.

    No need for positioning or z-index if the image is a header_logo.png is the background of the parent.

    Look at it this way once (I got rid of div#nav since it wasn't doing anything, I made your anchor text visible for this demo, I just guessed at a width for <h1> since I don't have your header_logo.png, made it red for the same reason ...) -
    Code:
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Untitled Document</title>
    <style type="text/css">
    html, body {
    	margin: 0;
    	font: 100% "Trebuchet MS", Arial, Helvetica, sans-serif;
    	color: #000;
    	background: #fc6;
    }
    #container {
    	width: 800px;
    	margin: 0 auto;
    	padding: 0 0 400px;
    	overflow: auto;
    	background: #999;
    }
    h1 {
    	height: 146px;
    	margin: 0;
    	text-indent: -9999px;
    	background: #f00 url(../images/header_logo.png) no-repeat;
    }
    	ul#nav {
    		margin: -146px 0 0;
    		list-style: none;
    		text-align: center;
    	}
    		ul#nav li {
    			display: inline-block;
    			width: 75px;
    		}
    			ul#nav a {
    				/*text-indent: -9999px; gets rid of wording */
    				text-decoration: none;
    				margin-left: 20px;
    				white-space: nowrap;
    			}
    </style>
    </head>
    <body>
    	<div id="container">
    		<h1><a href="#">Kyle</a></h1>
    			<ul id="nav">
    				<li><a href="#">Portfolio</a></li>
    				<li><a href="#">About me</a></li>
    				<li><a href="#">Resume</a></li>
    				<li><a href="#">Contact</a></li>
    			</ul>
    	<!--end container--></div>
    </body>
    </html>
    That header_logo.png might make more sense as a background of div#header instead of presenting it in the heading tag. Dunno... hard to say what your finished product is intended to look like.
    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


  •  

    Posting Permissions

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