Technique makes use of the unique way padding-top and padding-bottom deal with percentage values – they will be interpreted as a percent of the width of the containing element.
content-box
This is the default style as specified by the CSS standard. The width and height properties are measured including only the content, but not the padding, border or margin.
The width and height properties include the padding size, and do not include the border or margin.
border-box
The width and height properties include the padding and border, but not the margin. This is the box model used by Internet Explorer when the document is in Quirks mode. Note: Padding & border will be inside of the box
The HTML
Element represents self-contained content, frequently with a caption (
if (window.matchMedia("(min-width: 400px)").matches) {
/* the view port is at least 400 pixels wide */
} else {
/* the view port is less than 400 pixels wide */
}
The following example inserts the URL in parenthesis after each link:
a:after {
content: " (" attr(href) ")";
}
Columns
Divide the text in a
element into three columns, and specify a 40 pixels gap between the columns.