CSS does the width include the padding? – Stack Overflow

CSS does the width include the padding? – Stack Overflow

When you use percents on the margin/padding then it is relative to it’s OWN WIDTH only. Not height. Not even if you do margin-top:100%. The computed value will be 100% of it’s width.

For exmaple, if you did margin-top:50%; and the width on the element was 800px, it would move it down 400px

참고 사항 (height 에 percentage 값으로 지정하는 경우)

height:100% implies the element is going to have the 100% height of its parent container.

height:auto means, the element will have flexible height i.e. its height will depend upon the height of children elements of it

When you use percents on the margin/padding then it is relative to it’s OWN WIDTH only. Not height. Not even if you do margin-top:100%. The computed value will be 100% of it’s width.

For exmaple, if you did margin-top:50%; and the width on the element was 800px, it would move it down 400px

참고 사항 (height 에 percentage 값으로 지정하는 경우)

height:100% implies the element is going to have the 100% height of its parent container.

height:auto means, the element will have flexible height i.e. its height will depend upon the height of children elements of it

It is a wildcard, this means it will select all elements within that portion of the DOM.

For example, if I want apply margin to every element on my entire page you can use:

* {
    margin: 10px;
}

You can also use this within sub-selections, for example the following would add a margin to all elements within a paragraph tag:

p * {
    margin: 10px;
}

Your example is doing some css trickery to apply consecutive borders and margins to elements to give them multiple coloured borders. For example, a white border surrounded by a black border.

It is a wildcard, this means it will select all elements within that portion of the DOM.

For example, if I want apply margin to every element on my entire page you can use:

* {
    margin: 10px;
}

You can also use this within sub-selections, for example the following would add a margin to all elements within a paragraph tag:

p * {
    margin: 10px;
}

Your example is doing some css trickery to apply consecutive borders and margins to elements to give them multiple coloured borders. For example, a white border surrounded by a black border.

Perfect Full Page Background Image | CSS-Tricks