SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2007
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS // Making my Header align...

    Hi, im having a bit of trouble getting my header in the middle. I dont understand why it is not in the middle.. anybody know why?

    Website: www.lolage.co.uk

    HTML:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    	<title>Lolage - Graphical Services</title>
    	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    	<meta http-equiv="Content-Style-Type" content="text/css" />
    	<meta http-equiv="imagetoolbar" content="no" />
    	<meta name="description" content="Need some web graphics? Need an advertisement designing? If so you came to the right place!" />
    	<meta name="keywords" content="keywords, go, here, only, once, page, content, has, been, finished" />
    	<link rel="stylesheet" type="text/css" href="screen.css" media="screen,projection" />
    
    
    
    </head>
    
    
    <body>
    <div id="container">
    	<div id="header">
    		<img src="#" width="#" height="#"/> 
    	</div>
    	<ul id="menu">
    		<li><a href="index.htm">Home</a></li>
    		<li><a href="index.htm">About Us</a></li>
    		<li><a href="index.htm">Our Services</a></li>
    		<li><a href="index.htm">Portfolio</a></li>
    		<li><a href="index.htm">Prices</a></li>
    		<li><a href="index.htm">Contact Us</a></li>
    	</ul>
    	<div id="content">
    		<div class="wrapper">
    		<h1>lolage.co.uk</h1>
    		<p>lolage.co.uk, established in November 2007 for online service. The following is a partial listing of our services: Banner Ad Design, 
    		Header Design, Logo Design, Advertisement Design.</p>
    
    		</div>
    		<div id="footer">
    <img src="images/footer.jpg" width="#" height="#"/> 
    	</div>
    	</div>
    	
    </div>
    </body>
    </html>
    CSS:
    Code:
    /* CSS Document */
    
    * {
    	margin: 0;
    	padding: 0;
    }
    
    body {
    	background-image: url(images/bg.jpg);
    	background-repeat: repeat-x;
    	background-color: #2d2d2d;
    	color: #000;
    	font: normal 85%/140% tahoma, verdana, arial, helvetica, sans-serif;
    	letter-spacing: 1px;
    }
    
    h1, h2, h3, h4, h5, h6 {
    	font-family: tahoma, garamond, times, serif;
    	font-weight: bold;
    }
    
    h1 {
    	font-size: 1.75em;
    	line-height: 1.8em;
    }
    
    h2 {
    	font-size: 1.5em;
    	line-height: 1.55em;
    }
    
    h3 {
    	font-size: 1.05em;
    	line-height: 1.1em;
    }
    
    h4 {
    	font-size: 0.95em;
    	line-height: 1em;
    }
    
    h5 {
    	font-size: 0.85em;
    	line-height: 0.9em;
    }
    
    h6 {
    	font-size: 0.75em;
    	line-height: 0.8em;
    }
    
    img {
    	border: 0;                                /* fixes firefox bug */
    	display: block;
    }
    
    #container {
    	color: #FFF;
    	margin: 0 auto;
    	width: 750px;
    }
    
    #header {
    	margin: 0 auto;
    	background: url(images/banner.gif) no-repeat 0 0;
    	height: 156px;
    	width: 800px;
    }
    
    #menu {
    	overflow: hidden;
    	background-color: #e2e2e2;
    	list-style: none;
    }
    * html #menu {
    	height: 1%;	
    }
    	#menu li {
    		float: left;
    	}
    
    	#menu a {
    		background: transparent;
    		color: #000000;
    		display: block;
    		font: 14px/5px georgia, helvetica, sans-serif;
    		margin-right: 1px;
    		margin-left: 1px;
    		padding: 10px 0;
    		text-decoration: none;
    		text-indent: 48px;
    	}
    	#menu a:hover {
    		color: #FFD700;
    		font: 14px/5px georgia, helvetica, sans-serif;
    	}
    
    #content {
    	background: #e2e2e2;
    	color: #000;
    	min-height: 200px;
    }
    
    * html #content {
    	height: 200px;                              /* for ie */
    }
    #content .wrapper {
    	padding: 1em;
    }
    
    #content p {
    	margin: 0.5em 0;
    }
    
    #footer {
    	clear: left;
    	color: #999999;
    	padding-top: 40px;
    	text-align: center;
    	margin-left:2.5px;
    }
    
    #footer em {
    	border-top: 1px solid #999999;
    	display: block;
    	margin: 0 auto;
    	padding: 0.5em 3em;
    }
    Thanks Guys!

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2007
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If i make the container 800px that then makes my content box bigger but i dont want that to happen, is there another way around it?

  3. #3
    hi galen's Avatar
    Join Date
    Jan 2006
    Location
    New Haven, CT
    Posts
    1,228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the header div is wider than the container it's in. make it the same size or smaller than the container - or remove it from the container.

    Or! you could relative position it 25px to the left.

  4. #4
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,478
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lolage, remove the background from the header (I originally wrote this, so of course I'd know how to fix it) and apply it to the image - it's your header image afterall. And don't forget to add the width and height attribute values to the element, as well as the appropriate alt attribute text.

    Then create a new style rule ( #header img { } ) that sets the width of the image to the same size as the image's width, then set the margins on that selector to 0 auto; like so:

    Code:
    #header img {
    	margin: 0 auto;
    	width: 800px;
    }
    Though if you really want this to be displayed properly in smaller browser windows (less than 800px wide) I suggest you go with 750px for your actual image width, not 800 (to account for scroll bars, tabs and other things the user might want to use).


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
  •