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
    Jan 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Help with CSS code

    Hi guys

    Having an issue with some code that I need help with. Works with Firefox but not with IE.

    HTML

    Code:
    <body>
    <!-- Lets wrap all the content -->
    <div align="center">
    	<div id="wrapper">
    <!-- Build the Header -->
    		<div id="header">
    			<div id="headertitle"><img src="includes/images/headertitle.jpg" alt="Darksky Alaskan Malamutes" name="Darksky Alaskan Malamutes" id="Darksky Alaskan Malamutes" width="841" height="113" border="0"></div>
    			<div id="headerright"></div>
    		</div>
    	</div>
    </div>
    </body>
    Now the CSS

    Code:
    /* Base Styles */
    
    body
        {
        font: 62.5%/1.5 Verdana, Geneva, Arial, Helvetica, sans-serif;
        background-image: url(../images/bg.png);
    	margin: 0px;
    	padding: 0px;
    }
    
    #wrapper
        {
        width: 85%;
        background-color: #FFFFFF;
        max-width: 1280px;
        min-width: 880px;
    	text-align: left;
    }
    
    h1
        {
        font-size: 2.2em;
    }
        
    h2
        {
        font-size: 2.0em;    
    }
        
    h3
        {
        font-size: 1.8em;
    }
        
    h4
        {
        font-size: 1.6em;    
    }
        
    h5
        {
        font-size: 1.4em;    
    }
        
    p
        {
        font-size: 1.2em;
    } 
    
    /* Floats */
    
    .clear
        {
        clear:both;
    }
    
    .right
        {
        float: right;
    }
    
    .left
        {
        float: left;
    }
    
    /* Header */
    
    #header {
    	width: 100%;	
    	margin: 0px 0px 0px 0px;
    }
    
    #headertitle {
    	width: 841px;
    	float: left;
    	margin: 0px 0px 0px 0px;
    }
    
    #headerright {
    	background-image: url(includes/images/headerrightback.jpg);
    	background-position: left;
    	background-repeat: no-repeat;
    	background-color: #110138;
            margin-left: 841px;
    	position: relative;
    	height: 113px;
    	padding: 0px 0px 0px 0px;
    }
    What I am having trouble with is in IE there is a small white space between the main header image and the right hand side background - here is an image of it



    - I cannot work out how to remove it - please help

  • #2
    New Coder
    Join Date
    Jun 2007
    Location
    Quebec, Canada
    Posts
    64
    Thanks
    4
    Thanked 3 Times in 3 Posts
    hi, have you tried removing the line return between both elements? i am not quite sure.

    Code:
    <div id="headertitle"><img src="includes/images/headertitle.jpg" alt="Darksky Alaskan Malamutes" name="Darksky Alaskan Malamutes" id="Darksky Alaskan Malamutes" width="841" height="113" border="0"></div><div id="headerright"></div>
    also, you could simply use a background image, why do you need em sliced?

    if you need to include a link the the left part for some reason, include an anchor, set the anchor as display:block and set it's width and height, bingo, you can even set a background if you need a logo (transparent gif in this case)

  • Users who have thanked vexen for this post:

    gwmbox (01-11-2008)

  • #3
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    So simple - hehe thanks for that

    Greg

  • #4
    Regular Coder
    Join Date
    Nov 2006
    Posts
    247
    Thanks
    13
    Thanked 26 Times in 24 Posts
    If you don't want it all in one line, this works too:

    Code:
    #headerright {
    	float: left;
    	background-image: url(includes/images/headerrightback.jpg);
    	background-position: left;
    	background-repeat: no-repeat;
    	background-color: #110138;
            margin-left: 841px;
    	position: relative;
    	height: 113px;
    	padding: 0px 0px 0px 0px;
    }

  • #5
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,678
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello gwmbox,
    I'm sure there are some instances where the browser is supposed to take notice of a line-break in my code but I would just rather that never happened.

    If you make your code valid and add a doctype it works fine. I put a bunch of returns in between the two elements to show you:
    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">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <meta name="" content="authored by http://nopeople.com/Design" />
    <style type="text/css">
    /* Base Styles */
    body {
        font: 62.5&#37;/1.5 Verdana, Geneva, Arial, Helvetica, sans-serif;
        background-image: url(../images/bg.png);
    }
    * {
    	margin: 0;
    	padding: 0;
    	border: none;
    }
    #wrapper {
        width: 85%;
        margin: 20px auto;
        background-color: #FFFFFF;
        max-width: 1280px;
        min-width: 880px;
    	text-align: left;
    }
    /* Floats */
    .clear {
        clear:both;
    }
    .right {
        float: right;
    }
    .left {
        float: left;
    }
    /* Header */
    #header {
    	height: 113px;
    }
    #headertitle {
    	width: 841px;
    	height: 113px; /*because I don't have the image*/
    	background: #CCFF00;
    	float: left;
    }
    #headerright {
    	background: #110138 url(includes/images/headerrightback.jpg) left no-repeat;
       	margin-left: 841px;
    	height: 113px;
    }
    		h1 {font-size: 2.2em;}    
    		h2 {font-size: 2.0em;}    
    		h3 {font-size: 1.8em;}    
    		h4 {font-size: 1.6em;}    
    		h5 {font-size: 1.4em;}    
    		p {font-size: 1.2em;} 
    </style>
    </head>
    <body>
    	<div id="wrapper">
    <!-- Build the Header -->
        <div id="header">
            <div id="headertitle">
                <img src="includes/images/headertitle.jpg" alt="Darksky Alaskan Malamutes" width="841" height="113" />        
            </div>
            
            
            
            
            
            
                    <div id="headerright"></div>
        <!--end header--></div>
    <!--end wrapper--></div>
    </body>
    </html>
    Works in IE7 and FF anyway... IE6, who knows? If it doesn't, and if you need it to, let me know.
    Last edited by Excavator; 01-11-2008 at 01:59 AM.
    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
    •