Results 1 to 7 of 7

Thread: CSS compatibility in FF and IE

  1. #1
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Question CSS compatibility in FF and IE

    Hello all,

    I was just desining a template for a site that I am developing, and I ran into a problem. I desined the code in IE and it looks perfect, but as soon as I open it in FF, Everything is messed up. Here is the code that I am using:
    HTML Code:
    <html>
    <head>
    <title>
    Start
    </title>
    <style>
    .windowstop {width: 798px; height:0px; margin: 0px;  margin-top: 100px; text-align: left;}
    .bg {background: url("background.png") no-repeat top center;  height: 100%; width=100%; text-align: center;}
    body {background: url("bg-sides.png") repeat-x; margin: 0px 0px 0px 0px;}
    
    .cont-position {text-align:center;}
    .cont-top {background: url("cont-top.png") no-repeat top; height: 50px;}
    .cont-sides {background: url("cont-sides.png") repeat-y left;}
    .cont-bottom {background: url("cont-bottom.png") no-repeat bottom; height: 90px;}
    .cont {margin-left: 40px;}
    .cont-top-text {margin-top: 20px;margin-left: 40px;}
    .cont-bottom-text {margin-top: 40px;margin-left: 40px;}
    </style>
    </head>
    <body>
    <base target="_blank">
    
    <div class="bg">
    <div class="windowstop">
    
    <div class="cont-top">
    <div class="cont-top-text">
    Intro
    </div>
    </div>
    <div class="cont-sides">
    <div class="cont">
    Body<br><br><br><br><br><br><br><br><br>
    
    </div>
    </div>
    <div class="cont-bottom">
    <div class="cont-bottom-text">
    footer
    </div>
    </div>
    </div>
    </body>
    </html>
    Here are some screen shots:
    Internet Explorer:

    Firefox:

    If I try to start changing it for firefox, IE goes crazy, or vica versa. How can I get this to work in both browsers?
    Thanks,
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    It's hard to know what's exactly going on without the images. But this should give you a similar layout that's cross-browser. I added some colors so I could see what was going on. The <html> tag now equates to your old <body> tag. The <body> tag equates to your .bg div.

    Code:
     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>
    Start
    </title>
    <style type="text/css">
    html {
    	margin:0;
    	padding:0;
    	background:yellow;
    	height:100%;
    }
    body {
    	margin:0;
    	padding:0;
    	background:pink;
    	margin-top:100px;
    	height:100%;
    }
    #windowstop {
    	width:798px;
    	margin:0 auto;
    }
    
    .cont-position {text-align:center;}
    .cont-top {background:red url("cont-top.png") no-repeat top; height: 50px;}
    .cont-sides {background:blue url("cont-sides.png") repeat-y left;}
    .cont-bottom {background:green url("cont-bottom.png") no-repeat bottom; height: 90px;}
    .cont {margin-left: 40px;}
    .cont-top-text {margin-top: 20px;margin-left: 40px;}
    .cont-bottom-text {margin-top: 40px;margin-left: 40px;}
    </style>
    </head>
    <body>
    
    <div id="windowstop">
    	<div class="cont-top">
    		<div class="cont-top-text">
    			Intro
    		</div>
    	</div>
    	
    	<div class="cont-sides">
    		<div class="cont">
    			Body<br><br><br><br><br><br><br><br><br>
    		</div>
    	</div>
    	
    	<div class="cont-bottom">
    		<div class="cont-bottom-text">
    			footer
    		</div>
    	</div>
    </div>
    	
    </body>
    </html>

  3. #3
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default

    O.K., thats almost what I wanted, almost. I changed some things around, and it looks the same as before, in IE. In Firefox, major changes happened so I almost looked perfect.
    My Code:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>
    Start
    </title>
    <style type="text/css">
    html {
    margin:0;
    padding:0;
    background:yellow;
    height:100%;
    background: #0A9DFF url("background.png") no-repeat center top;
    margin-top: 100px;
    }
    body {
    margin:0;
    padding:0;
    background: url("bg-sides.png") repeat-x top;
    
    height:100%;
    }
    #windowstop {
    width:798px;
    margin:0 auto;
    }
    
    .cont-position {text-align:center;}
    .cont-top {background:url("cont-top.png") no-repeat top; height: 50px;}
    .cont-sides {background:url("cont-sides.png") repeat-y left;}
    .cont-bottom {background:url("cont-bottom.png") no-repeat bottom; height: 90px;}
    .cont {margin-left: 40px;}
    .cont-top-text {margin-top: 20px;margin-left: 40px;}
    .cont-bottom-text {margin-bottom: 40px;margin-left: 40px;}
    </style>
    </head>
    <body>
    
    <div id="windowstop">
    <div class="cont-top">
    <div class="cont-top-text">
    Intro
    </div>
    </div>
    
    <div class="cont-sides">
    <div class="cont">
    Body<br><br><br><br><br><br><br><br><br>
    </div>
    </div>
    
    <div class="cont-bottom">
    <div class="cont-bottom-text">
    footer
    </div>
    </div>
    </div>
    
    </body>
    </html>
    The Image:
    .
    -- The white bar at the top is supposed to be the top of the header image. How can I get this to show?
    -- Also, there are buttons in the image (I tryed a "Home Icon") and I eventually want to make that an image map, so I don't think that your code would work.
    -- The Intro text should be lower, but when I adjust .cont-top-text, the whole top moves, not just the text.
    Last edited by fileserverdirect; 05-14-2008 at 01:48 AM.
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

  4. #4
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    The white bar at the top is supposed to be the top of the header image. How can I get this to show?
    Which div is that reffering to? If you have a link to the page, please post it. It'll save a lot of back and forth. Like I said, without access to your images, I can only offer advice in the abstract.

    Also, there are buttons in the image (I tryed a "Home Icon") and I eventually want to make that an image map, so I don't think that your code would work.
    As long as the image map is set up correctly, there is no reason why it shouldn't.

    The Intro text should be lower, but when I adjust .cont-top-text, the whole top moves, not just the text.
    How are you adjusting it?

  5. #5
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default

    Hi,
    Quote:
    The white bar at the top is supposed to be the top of the header image. How can I get this to show?

    Which div is that reffering to?
    It is the background of html.
    Quote:
    Also, there are buttons in the image (I tryed a "Home Icon") and I eventually want to make that an image map, so I don't think that your code would work.

    As long as the image map is set up correctly, there is no reason why it shouldn't.
    If the image is a bacground, then it cant be an image map, can it????
    Quote:
    The Intro text should be lower, but when I adjust .cont-top-text, the whole top moves, not just the text.

    How are you adjusting it?
    I am ajusting this: (in bold)
    Code:
    .cont-top-text {margin-top: 20px;margin-left: 40px;}
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

  6. #6
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default

    Did you figuer it out?
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

  7. #7
    Join Date
    Nov 2007
    Location
    USA
    Posts
    170
    Thanks
    8
    Thanked 22 Times in 22 Posts

    Default

    Quote Originally Posted by fileserverdirect View Post

    I am ajusting this: (in bold)
    Code:
    .cont-top-text {margin-top: 20px;margin-left: 40px;}
    If you want to move the text down, I would try using the padding CSS property.

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
  •