0

The w3.css-class "w3-container" sets padding-top and padding-bottom to the value "0.01em". The effect is different from using "0" instead. What is the intention of this course of action?

Mary
  • 59
  • 1
  • 6

1 Answers1

1

I've seen this as workaround for issues of "Collapsing margins"

"... In CSS, the adjoining margins of two or more boxes (which might or might not be siblings) can combine to form a single margin. Margins that combine this way are said to collapse, and the resulting combined margin is called a collapsed margin. ..."

For example,

Problem (extract):

"... I expected the containing header element (grey) to appear at the top of the screen, but it seems to take the margin from the inner div (red). However if I add a border to the header it appears where I expect and the red inner div only moves slightly! ..."

One anwser (extract)

"...They can be overcome by adding padding to the parent element (in this case, the <header>)... Notice the padding:0.001em;. This makes the margins no longer collapse, but doesn't add any space to the <header>. ..."

Well, just guessing. Saludos,

L. Alejandro M.
  • 619
  • 6
  • 14