The Artima Developer Community
Sponsored Link

Agile Buzz Forum
margin: auto is difficult

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
margin: auto is difficult Posted: Jan 31, 2006 4:19 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: margin: auto is difficult
Feed Title: Michael Lucas-Smith
Feed URL: http://www.michaellucassmith.com/site.atom
Feed Description: Smalltalk and my misinterpretations of life
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Michael Lucas-Smith

Advertisement

As of WithStyle V4 version 4.875 we now have proper margin: auto behaviour for regular blocks. This means that you can actually center a block in the middle of a window area using just the single style 'margin: auto'. If you give it a fixed width and height, you should see the blocks content in the middle of the screen.

There is one caveat to this. If your content overflows the margin: auto'd block, then the margin-top and margin-bottom will collapse down to 0 pixels. And this is where other rendering technologies come unstuck. Below are pictures of IE7, Firefox and WithStyle rendering the same document using margin: auto; width: 400px; height: 200px. Firefox comes the closest but assumes there is overflow and therefore collapses the top/bottom. IE6 and IE7b2 just stick the block in the top/left corner as if it had no margin what so ever.

Speaking of IE7b2, if you go to www.w3.org and try to hover over the section links, to our surprise we found that it did not honor the hover styles and change the links to be red with a yellow background! Wow.. talk about a regression.

WithStyle V4:

WSv4

IE7:

WSv4

Firefox:

WSv4

Read: margin: auto is difficult

Topic: Setting Norms to help internalise Agile values Previous Topic   Next Topic Topic: Agile is ... Agile isn't ...

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use