Wrox Programmer Forums
|
CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the CSS Cascading Style Sheets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 22nd, 2007, 03:19 PM
Authorized User
 
Join Date: Mar 2007
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kennethjaysone Send a message via Yahoo to kennethjaysone
Default margin values?

From what i have studied, margins can be set using the following values: length / percentage or auto.

The lengths can be from pixels, points and inches etc.

That's straight forward along with percentages...

How does auto work?

What does auto mean? how does a browser render it on screen. I've tried looking at all CSS references online and they do not really explain what auto is.:) :)

Thank you all in advance for reading and giving your thoughts and views on this topic.

Kenneth

 
Old December 22nd, 2007, 08:37 PM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

:( Join the club. I'm not really sure what it means other than telling the browser to figure out for itself what the margin is. Note that it results in a different display from leaving the margin undeclared and letting the browser figure things out for itself.

I CAN tell you that in practice it is one of the most powerful CSS techniques you can use. There are a number of cases where using margin: auto; is the only way to fix a text-algin:center; that isn't centering properly. It's an important trick to have you your back pocket when you're trying to get your stylesheet to act the way you want. It's one of the first things I try when something isn't acting the way I thought it would.

-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
 
Old December 23rd, 2007, 05:32 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Fortunately, browsers follow a defined pattern when "figuring out" what to do. You can read more about it here:

http://www.w3.org/TR/CSS21/visudet.h...hs_and_margins

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
When to use Padding, Margin and Position? chobo2 CSS Cascading Style Sheets 1 May 29th, 2008 08:58 AM
Printing & Setting the margin of document... ravi_bachwala General .NET 1 August 9th, 2007 06:54 PM
Inconsistent Margin-Left Behavior rsearing CSS Cascading Style Sheets 5 August 6th, 2007 12:35 PM
Collapsing Margin Questions, P310-312 MRoberts BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 June 10th, 2005 10:34 AM
Printer Margin & Fillcolor blackdevil1979 Beginning VB 6 0 January 31st, 2005 04:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.