Why is this not centered

Discussion in 'Site Programming, Development and Design' started by JimS, Jul 2, 2010.

  1. Can anyone tell me why this is not centered at Winhost? It works fine on my local computer. Both the class H1 and the align=center should cause it to be centered.

    ...<tr><th class="H1" colspan="2" align="center"><div style="width:3em; margin-top:-1.1em; background-color:White; color: #CC3300; font-size:larger;">OR</div></th></tr>...

    Thanks.
     
    Last edited by a moderator: Oct 14, 2015
  2. It works fine now that I have removed the class=H1, but the attributes from H1 on the div tag, and kept the align=center. I have no idea why. With H1, but not align=center (where I started) it doesn't work. The other H1's on the page work fine, and all work well on my development machine.

    One of life's mysteries.
     
  3. CSS is parsed in the visitor's browser, so the server/platform/host doesn't really come into play.

    When you add the style inline, as you have in the DIV above, you override anything that might be in a stylesheet, so the original problem might have been in the stylesheet itself. Elements inherit styles, so the order in which the styles are defined makes a difference.
     
  4. Thank you. Good point about the server making no difference, and yet there was a difference. Possibly I used a different browser when testing locally and when testing on Winhost. That would explain the difference I saw.
     
    Last edited by a moderator: Oct 14, 2015
  5. Yeah, that could very be. Every browser parses CSS differently, unfortunately. You would think it was a standard, but in practice it is not.

    FYI; the most standards compliant browser is Opera. Of course being standards compliant means that it breaks a lot of sites that use non-standard or browser specific CSS. It's kind of a no-win situation at the moment.
     

Share This Page