Re: align property

Le Mer 26 janvier 2011 7:34, Mark Kenny a écrit :
>>
>> I understand there is always other way around something to achieve
>> what we need, but why not simply use logical solutions instead of
>> those "workarounds"?
>
>
> Actually, I think that's quite a fair point. I still don't quite like
> margin: 0 auto; though I use it all the time -- horizontal-align: center;
> would make much more sense.

'margin: 0 auto;'
does not just horizontally centers a block within its block container: the
code 'margin: 0 auto;' removes the margin-top and margin-bottom of such
block too.


> I also never got why vertical-align: middle; never worked like you'd
> expect
> it to work. Can anyone shed any light on that?

First, you can blame the CSS spec writers for not illustrating how the
vertical-align property is supposed to display/affect text (or images or
table cells) in short-and-easy-to-grasp examples with expected-results
diagrams in CSS1, then in CSS 2 and still today in CSS 2.1

E.g.:
http://www.gtalbot.org/DHTMLSection/vertical-align-values.html
(I still would need to add pictures in such webpage)

Second, you can blame web browser manufacturers for not implementing it
correctly during ~= 10 years:

http://www.gtalbot.org/BrowserBugsSection/MSIE7Bugs/#bug167

http://www.gtalbot.org/BrowserBugsSection/MSIE7Bugs/#bug43

http://www.gtalbot.org/BrowserBugsSection/Opera10Bugs/#bug29

http://www.gtalbot.org/BrowserBugsSection/Opera10Bugs/#bug30

http://www.gtalbot.org/BrowserBugsSection/Opera10Bugs/#bug31

The web development tutorial sites (w3schools, site point, etc.) too
should take a part of the blame for not correctly explain and illustrate
such property and others.

Often, what web authors want to vertically align can not be achieved by
simply using 'vertical-align: middle' anyway.
Beginner web authors often want very sophisticated websites while
expecting simple declarations to deal with massive code (html, css,
javascript) which they copied in all sorts of other websites.

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 16:20:54 UTC