Introduction to the CSS basic box model. When laying out a document, the browser's rendering engine represents each element as a rectangular box according to the standard CSS basic box model. CSS determines the size, position, and properties (color, background, border size, etc.) of these boxes. Every box is composed of four parts (or areas2. I would suggest to use box-sixing:border-box; because it's not affecting the content of the element in connection to a usual CSS border. An inset-shadow might overlap the contents. In addition to that there's a better browser support for box-sizing:border-box like Mathias commented. Share.
Your article element has two children: An input element and the textarea, which has height: 100% . So articles 's height adds up to 100% plus the height of the input element. That's why it overflows. To fix that, you could give a fixed height to input , for example 40px, and use height: calc ( 100% - 60px) ; (subtracts the 40px height plus 2 x
The basic difference between CSS grid layout and CSS flexbox layout is that flexbox was designed for layout in one dimension - either a row or a column. Grid was designed for two-dimensional layout - rows, and columns at the same time. The two specifications share some common features, however, and if you have already learned how to use flexbox . 90 290 173 226 355 73 224 249 223