W3C home > Mailing lists > Public > www-style@w3.org > January 2011

Re: margins, ems and context

From: Gérard Talbot <www-style@gtalbot.org>
Date: Wed, 26 Jan 2011 06:55:14 -0800
Message-ID: <7ab162e44d62e1030770e607de693b3a.squirrel@cp3.shieldhost.com>
To: "Niels Matthijs" <niels.matthijs@internetarchitects.be>
Cc: "W3C style mailing list" <www-style@w3.org>

Le Mer 26 janvier 2011 0:30, Niels Matthijs a écrit :


> [div class="whatever"]
>      [h1]my header[/h1]
>      [p]some paragraphs[/p]
>      [ul]...[/ul]
>      [div class="more"][<a href="#"]read more about whatever[/a][/div]
> [/div]
> for the css, I set my basic layout grid like this:
> ..whatever>* {margin:0.75em 1em;}
> There you have your left and right em margins on the h1 heading. Now if
> you start fiddling with the h1 font-size it will start jumping around,
> which is not very cool, destroying the vertical grid I've just created.


can you try this:

div.whatever {margin: 0.75em 1em;}

div.whatever > * {margin-left: inherit;}

The horizontal alignment should be meeting what I understand from your
description. The h1 element should horizontally start at the same x
position of others.

If you encounter problems, then please consider posting the url of a
reduced demo.

regards, Gérard
CSS 2.1 Test suite RC5 (January 11th 2011)

Contributions to CSS 2.1 test suite

Web authors' contributions to CSS 2.1 test suite
Received on Wednesday, 26 January 2011 14:55:51 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 11 February 2015 12:34:47 UTC