treehouse : what would you like to learn today?
Web Design Web Development iOS Development

margin-left not taking effect for IE

  • I've added a style tag to a table and had a margin-left that appears on Chrome and FF but not on IE 9. I did the double margin-left with the second one having the "!important" and still it's not applied.

      <table align="center" border="1" cellpadding="1" cellspacing="1" height="46" style="margin-left: 55px; /* for FF */ margin-left: 0 !important; /* for IE */margin-top: 24px; margin-bottom: 45px;" width="685"> 
    
  • We'd need to see the table in action. Do you have a link?

  • With the code you posted, it should not have a left margin in ANY browser, simply due to margin-left: 0 !important;.

  • Hello Pressuredat19,

    May I first suggest you use div tags instead of tables and then CSS instead of inline CSS and old HTML that are deprecated.

    If you choose to stick with the table you can still style it using CSS like so

    table {
      position: relative;
      width: 685px;
      height: 46;
      margin:0 auto; /* centers it*/
      margin-left: 0;
      border: 1px solid black;
    }
    td {
      padding: 1px;
      margin:1px;
    }

    This should solve your issues with multiple browsers. If it does not link us what you have :D.

    Good luck

  • @otc Why are you suggesting divs instead of a table?

    How do you know he isn't using a table properly?