SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2005
    Posts
    191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Image to CSS with an included text field...How?

    Hi guys,

    After unsuccessfully trying myself, I thought Id throw myself on the mercy of the sitepoint forums. Ive got this image:

    http://img189.imageshack.us/img189/4238/temp5lc.jpg

    How would I would CSS to convert that into a header which has seperate buttons for the navigation as well as positioning a text field over the 'Search' part of the image?

    Any ideas?! Im tearing my hair out!

  2. #2
    Non-Member Egor's Avatar
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    7,305
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    The quickest way would be to do it through absolute positioning. Here's a skeleton you can work with:

    HTML:
    Code:
    <div id="header">
    
    	<ul>
    		<li><a href="/">Link Name</a></li>
    		<li><a href="/">Link Name</a></li>
    		<li><a href="/">Link Name</a></li>
    		<li><a href="/">Link Name</a></li>
    		<li class="last"><a href="/">Link Name</a></li>
    	</ul>
    
    	<form method="" action="">
    		<input type="text" />
    	</form>
    
    </div>
    CSS:
    Code:
    #header {
    width: 700px;
    height: 300px;
    position: relative;
    border: 1px solid #000;
    background: url(images/bg_header.jpg) no-repeat left top;
    }
    
    #header ul, #header li, #header form {
    margin: 0;
    padding: 0;
    list-style-type: none;
    }
    
    #header ul {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    border-top: 1px solid #000;
    }
    
    #header li, #header li a {
    display: block;
    float: left;
    }
    
    #header li {
    border-right: 1px solid #000;
    }
    
    #header li.last {
    border-right: none;
    }
    
    #header li a {
    height: 30px;
    padding: 0 10px;
    line-height: 30px;
    }
    
    #header form {
    width: 200px;
    height: 100px;
    position: absolute;
    right: 0;
    bottom: 0;
    border: 1px solid #000;
    }
    Use that as a starting point. The width/height/etc values would obviously need to be adjusted to fit your header, and I've added borders in to help you see what's happening.


Bookmarks

Posting Permissions

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