+ Reply to Thread
Results 1 to 5 of 5

Thread: CSS help please

  1. #1
    levi1245 is offline x10Hosting Member levi1245 is an unknown quantity at this point
    Join Date
    Feb 2010
    Posts
    3

    CSS help please

    I've been doing html, css and php for a while, but I cannot get the css design to look the same in different browsers. I have tried everything I can think of. the margin-left:auto; and margin-right: auto; works in google chrome to center a <div> but not in IE. I haven't tested this in Firefox or any other browsers yet. I would like a little help to get it to work in both IE and Google Chrome. Any help would be appreciated.

  2. #2
    MaestroFX1's Avatar
    MaestroFX1 is offline Community Advocate MaestroFX1 has a spectacular aura about
    Join Date
    Feb 2008
    Location
    Area 51
    Posts
    1,577

    Re: CSS help please

    If it is working in Chrome, it should work in Firefox 3+ and IE8+.

    Have you tried (overriding?) using
    ---------
    <!--[if lte IE 6]>
    <link href="./4_ie6_only.css" rel="stylesheet" type="text/css" />
    <![endif]-->
    ---------

  3. #3
    levi1245 is offline x10Hosting Member levi1245 is an unknown quantity at this point
    Join Date
    Feb 2010
    Posts
    3

    Re: CSS help please

    I have scoured the internet trying to figure out how to do that, but never could figure it out... and I have IE 8. So either something is wrong with IE or my coding... here is the css code:
    Code:
    <style type="text/css">
    body {
    background: #0039E6;
    color: #33FFFF;
    }
    a {
    text-decoration: underline;
    }
    a:hover {
    text-decoration: none;
    }
    #main {
    margin-left: auto;
    margin-right: auto;
    width: 750px;
    height: 726px;
    border: solid 1px black;
    background: #33FFFF;
    }
    #banner {
    margin-left: auto;
    margin-right: auto;
    width: 700px;
    height: 150px;
    border: solid 1px black;
    background-image: url('images/banner.png');
    }
    #sidebar {
    float: left;
    margin-left: auto;
    width: 238px;
    height: 445px;
    padding: 5px;
    border: solid 1px black;
    background: #0039E6;
    }
    #content {
    float: right;
    margin-right: auto;
    width: 418px;
    height: 445px;
    padding: 5px;
    border: solid 1px black;
    background: #0039E6;
    }
    #marquee {
    border: 1px solid black;
    margin-left: auto;
    margin-right: auto;
    background: #0039E6;
    width: 692px;
    height: 20px;
    margin-left: 23px;
    padding: 5px;
    }
    </style>
    although it doesn't look right in google chrome now after I tried to figure the problem out on my own....

  4. #4
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: CSS help please

    http://css-discuss.incutio.com/wiki/...h_auto-margins

    They use:

    Code:
    body {
      text-align: center;
      min-width: 500px;
    }
    #wrapper {
      text-align: left;
      width: 500px;
      margin-left: auto;
      margin-right: auto;
    }
    where 'wrapper' is the main content div you are trying to center.
    Last edited by descalzo; 04-09-2011 at 12:39 PM.
    Nothing is always absolutely so.

  5. #5
    levi1245 is offline x10Hosting Member levi1245 is an unknown quantity at this point
    Join Date
    Feb 2010
    Posts
    3

    Re: CSS help please

    okay. thanks I'll try it.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers