By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,766 Members | 1,265 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,766 IT Pros & Developers. It's quick & easy.

Absolute positioning and margins

P: n/a
Hello.

Should /margin/ properties take effect on absolutely-positioned blocks?
I thought not, but the referred sample HTML [1] seems to prove me wrong
both on IE 6.0 and Firefox 0.8. I thought the /margin/ property should
have no effect, since the location of the positioned block is being
controlled by the /top/, /left/, etc. properties. The CSS2 Specification
states:

"Positioned elements generate positioned boxes, laid out according to
four properties: [top, right, bottom, left]"

There is no mention of /margin/. So, if I intend to have a block at (0,
0), I should only have to set /top/ and /left/ to 0 and not be concerned
about setting /margin-top/ and /margin-left/ to 0 as well.

Does anybody see something in the text of the Specification which I may
have missed?

[1] http://undl.org.br/temp/absmarg.html

Thank you,

--
Ney André de Mello Zunino
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Ney André de Mello Zunino wrote:
Should /margin/ properties take effect on absolutely-positioned blocks?
Yes.
I thought not, but the referred sample HTML [1] seems to prove me wrong
both on IE 6.0 and Firefox 0.8. There is no mention of /margin/ [in spec].
Not in that place. Read whole spec sometime, it has lots you have missed.
So, if I intend to have a block at (0,
0), I should only have to set /top/ and /left/ to 0 and not be concerned
about setting /margin-top/ and /margin-left/ to 0 as well. Does anybody see something in the text of the Specification which I may
have missed?


This, for example.
http://www.w3.org/TR/CSS21/visudet.h...replaced-width

Especially the blockquote in the middle of that section. I wonder where
they quoted it...
--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
I'm looking for work | Etsin työtä
Jul 20 '05 #2

P: n/a
Ney André de Mello Zunino wrote:
Hello.

Should /margin/ properties take effect on absolutely-positioned blocks?
I thought not, but the referred sample HTML [1] seems to prove me wrong
both on IE 6.0 and Firefox 0.8. I thought the /margin/ property should
have no effect, since the location of the positioned block is being
controlled by the /top/, /left/, etc. properties. The CSS2 Specification
states:

"Positioned elements generate positioned boxes, laid out according to
four properties: [top, right, bottom, left]"

There is no mention of /margin/. So, if I intend to have a block at (0,
0), I should only have to set /top/ and /left/ to 0 and not be concerned
about setting /margin-top/ and /margin-left/ to 0 as well.

Does anybody see something in the text of the Specification which I may
have missed?

[1] http://undl.org.br/temp/absmarg.html

Thank you,


http://www.w3.org/TR/CSS21/box.html#box-dimensions
*Each box has* a content area (e.g., text, an image, etc.) and optional
surrounding *padding, border, and margin* areas; ......

--
Gus
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.