Re: margins, ems and context

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

[snipped]

> [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.

Niels,

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)
http://test.csswg.org/suites/css2.1/20110111/html4/toc.html

Contributions to CSS 2.1 test suite
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/

Web authors' contributions to CSS 2.1 test suite
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/web-authors-contributions-css21-testsuite.html

Received on Wednesday, 26 January 2011 14:55:51 UTC