Fact-checked by Grok 2 weeks ago

CSS box model

The CSS box model is a fundamental aspect of Cascading Style Sheets (CSS) that defines how every is represented as a rectangular box in the visual formatting model, consisting of four concentric areas: the area, , , and margin. The area holds the element's primary material, such as text, images, or sub-elements, with its dimensions set by the width and height properties. Surrounding the is the area, which provides transparent or background-filled space inside the ; the area encircles the with configurable width, style, and color; and the outermost margin area creates additional transparent space for separation from adjacent elements. Background properties apply to the , , and areas, but not the margin. The box model's sizing behavior is governed by the box-sizing property, which defaults to content-box—meaning the specified width and height apply only to the content area, with padding and border adding to the total dimensions. Alternatively, setting box-sizing to border-box includes the padding and border within the specified width and height, simplifying layout calculations by subtracting those values from the total to determine content size (never negative). This property, introduced in CSS Level 3, addresses historical inconsistencies in browser rendering, such as early Internet Explorer versions that deviated from the standard content-box model, ensuring more predictable spacing and positioning in modern web design. Margins and padding can collapse or interact in specific ways during layout, influencing the overall document flow and visual structure.

Fundamentals

Definition and Purpose

The CSS box model is a fundamental concept in Cascading Style Sheets (CSS) that represents every as a rectangular box, comprising an inner content area surrounded by optional padding, border, and margin regions. This model applies to elements in the document tree, generating zero or more boxes that form the basis of visual rendering on screen or other media. The term "box" originates from the box-oriented formatting metaphor introduced in the CSS Level 1 specification, published by the (W3C) in December 1996, which described elements as resulting in rectangular boxes for layout purposes. The primary purpose of the CSS box model is to provide a consistent and predictable mechanism for controlling the , spacing, and visual structure of . By defining how these box components interact, it enables developers to precisely manage the dimensions and positioning of elements within the visual formatting model, ensuring reliable rendering across different browsers and devices. This structured approach separates content from presentation, allowing for flexible styling without altering the underlying structure. Within the broader , the box model integrates with the and mechanisms to apply styles hierarchically. CSS rules from multiple sources—such as author, user, and stylesheets—prioritizing based on specificity and order, while inherited properties propagate from parent elements to their descendant boxes. This ensures that box properties like margins and are computed and applied consistently, maintaining the integrity of the document's visual hierarchy.

Visual Representation

The CSS box model represents each element as a rectangular box composed of concentric layers that define its layout and spacing in a document. At the core is the content area, which holds the element's primary content such as text or images and is sized by the width and height properties. Surrounding the content is the padding, an optional inner spacing that separates the content from the border, specified individually for top, right, bottom, and left sides via properties like padding-top. Enclosing the padding is the border, which forms the visible or invisible edge of the box with configurable width, style, and color for each side (e.g., border-right-width). Finally, the outermost layer is the margin, which creates transparent space around the border to separate the box from adjacent elements, also definable per side with properties such as margin-left. A standard diagram of the box model illustrates these layers as nested rectangles, with arrows or labels indicating the dimensions: the innermost rectangle for width and height; adjacent areas for extents (top, right, bottom, left); the widths surrounding them; and the outermost margin areas extending beyond. This visualization highlights the total occupied space as the sum of , , and , while margins contribute to external spacing without altering the box's intrinsic dimensions. The box model applies differently based on whether an element generates a block-level or inline box, influencing how these layers are rendered in the visual formatting model. Block-level elements, such as paragraphs or divs, form independent rectangular boxes that typically span the full width of their container, with all layers (content, padding, border, margin) fully applying to define vertical and horizontal spacing. In contrast, inline elements, like spans or links, generate "inline boxes" that flow horizontally and wrap as needed; here, the model still applies, but vertical padding, borders, and margins are often ineffective or cause overlaps on non-replaced inline content, while horizontal aspects influence the inline flow. A common misconception is that margins are part of the element's or visible ; in reality, margins are always transparent and do not receive the element's color or , which extends only to the and areas, ensuring clear separation in .

Components

Content Area

The area represents the innermost rectangular region of a CSS , dedicated to holding the element's primary , including text, images, videos, or other replaced elements. This area forms space where the actual rendered material of the element resides, distinct from any surrounding layers. Its dimensions are primarily controlled by the CSS width and height properties, which can be set explicitly or computed based on the and the containing block. For different types of content, the content area exhibits varied sizing behaviors. In block-level elements, such as <div> or <p>, the width defaults to the full available space of the containing block if set to auto, while the height adjusts automatically to fit the flowed , like paragraphs of text that wrap according to the available width. Replaced elements, such as <img> tags, rely on their intrinsic dimensions—such as an image's natural size—to define the content area if no explicit width or height is specified, ensuring the renders at its intended scale. This auto-sizing mechanism allows flexible adaptation to content volume without predefined constraints. The effective height of the content area, particularly for text-based content, is shaped by interactions with properties like line-height and white-space. The line-height property establishes the minimum height of each line box within the content area, stacking these boxes vertically to accommodate multi-line text and preventing overlap between lines. For instance, setting line-height: 1.5 on a paragraph increases the vertical spacing per line, thereby expanding the overall content height to reflect the cumulative line boxes. Meanwhile, the white-space property governs how whitespace characters (spaces, tabs, newlines) are preserved or collapsed, directly influencing text flow and the resulting content area dimensions; for example, white-space: pre retains all spaces and line breaks, potentially leading to wider or taller content areas compared to the default normal value that collapses sequences of whitespace. Content overflow occurs when the material inside exceeds the area's specified or computed dimensions, manifesting without regard to external influences. A common scenario involves text in a block element with a fixed width: if a long, unbreakable word (e.g., a ) cannot wrap, it protrudes beyond the right edge of the area, creating horizontal . These situations highlight how the area's sizing prioritizes the element's declared properties over the actual volume. The dimensions of the content area can be influenced by the box-sizing property, with further details provided in the Box-Sizing Variants section.

Padding

in the CSS box model denotes the area surrounding an element's content area but inside its , creating internal spacing that visually separates the content from the bordering edge. This padding extends the element's background color, image, or other background properties across its area, allowing the visual styling to fill the space without altering the content dimensions themselves. By default, the padding contributes to the overall size of the element's box, influencing layout and presentation. The padding is controlled primarily through the shorthand property **padding**, which can set values for all four sides simultaneously, or via the individual longhand properties **padding-top**, **padding-right**, **padding-bottom**, and **padding-left** for precise control over each side. These properties support various value types, including absolute lengths such as pixels (px) or relative units like ems (em) and percentages (%), where percentages are computed relative to the width of the containing block for horizontal paddings and the height for vertical ones. Negative values are invalid and ignored. For instance, the declaration padding: 1em; applies uniform spacing of 1em to all sides, while padding: 10px 20px 5px; sets 10px top and bottom, and 20px left and right, with the bottom overridden to 5px in three-value syntax. In scenarios involving vertically stacked elements, padding exhibits no collapse behavior, meaning the bottom padding of one block-level element and the top padding of the adjacent element below it combine additively without reduction, ensuring the full specified space is preserved between their content areas. This contrasts with margin behavior and helps maintain consistent vertical spacing in layouts. Furthermore, padding enlarges the interactive hit area of elements like buttons or links, expanding the clickable or hoverable region beyond the content to include the padded space, which enhances accessibility and user experience by providing more forgiving touch targets.

Border

In the CSS box model, the border forms the layer immediately surrounding the padding, creating a visible or invisible edge that encloses the content and padding areas. It is defined by three primary aspects: width, , and color, which together determine its appearance and can be applied to all four sides of a or customized per side. The shorthand allows for concise declaration of border properties on an , setting the width, , and color for all four borders simultaneously. Its syntax is border: <'border-width'> || <'border-style'> || <'border-color'>, where values can be specified in any order, and omitted components revert to their initial values. For example, border: 2px solid [blue](/page/Blue); applies a 2-pixel-wide solid blue border to all sides, resetting the border-image property to none. The border-width property specifies the thickness of the border, applicable to the shorthand or individually via shorthands like border-top-width. It accepts keyword values such as thin (typically 1px), medium (3px), or thick (5px), or any positive length like 5px or 0.5em; the initial value is medium, though it effectively becomes 0 if the border style is none or hidden. Up to four values can be provided to set widths for top, right, bottom, and left sides respectively. Border appearance is controlled by the border-style property, which defines the line pattern and is required for a border to be visible, as the initial value is none. Valid styles include solid for a continuous line, dashed for broken lines, dotted for small dots, double for two parallel solid lines, and 3D effects like groove, ridge, inset, and outset; hidden behaves like none except in table border conflict resolution. Like width, it supports one to four values for all or specific sides. The border-color property sets the color of the border, defaulting to currentColor (the element's text color) if unspecified. It accepts any <color> value, such as named colors (red), hex (#ff0000), or RGB functions, and can be applied to all sides or individually with up to four values. In the shorthand border, color values influence the overall border rendering. For finer control, individual side properties exist, such as border-top-style, border-right-width, and border-bottom-color, enabling asymmetric borders without affecting other sides. These per-side properties follow the same value sets as their omnidirectional counterparts and are commonly used for directional designs. The border-radius property introduces rounded corners to the border box, altering its shape from rectangular to elliptical arcs. Its syntax is border-radius: <length-percentage>{1,4} [ / <length-percentage>{1,4} ]?, where the first set defines horizontal radii and the optional slash-separated set defines vertical radii for the top-left, top-right, bottom-right, and bottom-left corners; the initial value is 0, resulting in sharp corners. Percentages are relative to the border box's width and height, and the property rounds the corners of the border and clips the background to the curved path. The content is clipped to the curve only if overflow is not visible (its initial value). It interacts with the overall box shape by potentially overlapping adjacent sides if radii are large. Shorthands like border-top-left-radius allow specific corner control. For tables, the border-collapse property determines how borders between cells are rendered, with values separate (initial, treating borders as distinct with possible spacing) or collapse (merging adjacent borders into a single line). In collapse mode, borders share edges, with widths halved and conflicts resolved via a harmonization algorithm prioritizing style, width, and color; it applies only to table and inline-table elements and ignores border-spacing. This mode overrides certain styles, such as converting inset to ridge on shared edges, to maintain visual consistency.

Margin

The margin in the CSS box model represents the outermost layer of an element's box, creating transparent external to the that separates it from adjacent elements without inheriting the element's color or styles. This external spacing ensures visual isolation between boxes in the flow, allowing developers to control whitespace without affecting the content's visual appearance. Unlike , which is internal and background-filled, margins remain empty and are used primarily for layout separation in block-level elements. Margins are declared using the margin shorthand property or individual longhand properties such as margin-top, margin-right, margin-bottom, and margin-left, each accepting values as lengths (e.g., 10px), percentages relative to the containing block's width, or the keyword auto. The shorthand margin can specify one to four values, applying them clockwise starting from the top (e.g., margin: 1em; sets all sides to 1em, while margin: 0 auto; centers a block element horizontally by setting left and right margins to automatic widths, assuming a defined element width). The auto value instructs the browser to compute the margin based on available space, commonly used for horizontal centering in block layouts. A key behavior of margins is collapsing, which occurs only for vertical (top and bottom) margins between certain block-level elements, where adjoining margins merge into a single collapsed margin equal to the maximum of the two values, rather than summing them. This applies to adjacent siblings (e.g., the bottom margin of one block collapses with the margin of the next in-flow block-level , unless separated by clearance, , or ) and to parent-child relationships (e.g., a parent's margin collapses with its first in-flow block-level 's margin if the parent has no or and the child has no clearance). Collapsing does not occur with floated, absolutely positioned, or inline-block elements, nor within flex or containers, and it can involve multiple margins forming a single effective space. Empty blocks with and bottom margins also collapse if no separating content, height, or minimum height is present. Negative margins pull elements closer together or cause overlaps, altering layout by reducing or inverting the separation space; for instance, a negative margin-top on a child can shift it upward into or beyond its parent's space. In collapsing scenarios, negative margins are incorporated by subtracting the absolute value of the most negative margin from the largest positive one (or using the most negative if all are negative), potentially resulting in a negative collapsed margin that shifts subsequent elements. This behavior enables precise overlaps, such as in pull quotes or custom layouts, but requires careful management to avoid unintended stacking or flow disruptions.

Sizing and Calculations

Width and Height Properties

The width and height properties in CSS specify the dimensions of an element's area in the default box model, where these values directly define the inner box excluding , border, and margin. These properties accept values such as auto, fixed lengths (e.g., px), relative lengths (e.g., em), or percentages relative to the containing block's corresponding dimension. In addition, since CSS Intrinsic & Extrinsic Sizing Module Level 3, they support intrinsic sizing keywords such as min-[content](/page/Content), max-[content](/page/Content), and fit-[content](/page/Content)(<length-percentage>). For instance, width: 200[px](/page/PX) sets a fixed width of 200 pixels, while width: 50% computes to half the width of the parent element's area. In the default content-box model, the total horizontal space occupied by a block-level is calculated as the sum of its content width plus the horizontal , , and margins: total width = content width + + + + + margin-left + margin-right. This formula ensures that specifying a width does not include the additional layers, potentially causing elements to exceed their intended if or borders are added. Vertically, the total height follows a similar additive principle, but height calculations often rely more on content flow. The height property defaults to auto, which computes based on the element's content and the normal flow of document layout, expanding to fit inline or block children as needed. Explicit constraints via min-height and max-height override or limit this auto behavior; for example, min-height: 100px ensures the content area is at least 100 pixels tall, while max-height: 500px caps it to prevent excessive growth. These min/max properties also support lengths, percentages, or none for max-height, with percentages resolved against the containing block's height if explicitly defined. CSS distinguishes between intrinsic sizing, derived directly from the element's (e.g., the natural width of an or the space needed for text without wrapping), and extrinsic sizing, imposed by external constraints like fixed lengths or relative to the parent. For in height, a key caveat arises when the parent's height is auto or otherwise indefinite, in which case the percentage value resolves to auto, preventing reliable vertical in fluid layouts. This dependency on the containing block underscores the need for explicit heights up the layout chain to enable percentage-based sizing effectively.

Box-Sizing Variants

The box-sizing CSS property defines how the total width and height of an element are calculated, altering the interpretation of the box model by specifying whether the declared dimensions apply to the content area alone or encompass and as well. This property accepts two primary values: content-box, the default as specified in the CSS Box Sizing Module Level 3, where the width and height properties set the size of the content area only, with and added externally; and border-box, where the width and height include the content, , and , making the total box size more predictable for purposes. In the content-box model, the total width of an is computed as the width plus left and right plus left and right widths plus left and right margins, while the total height follows a similar additive structure for vertical dimensions. Conversely, under border-box, the specified width and height represent the total including and , so the area adjusts inward: for instance, an with width: 350px, padding: 10px, and border: 5px solid would yield a width of 320px, with the overall box (excluding margins) fixed at 350px. Margins remain external in both models, added beyond the specified dimensions. This distinction is crucial for precise layouts, as content-box can lead to unexpected overflows when or borders are applied to fixed-size elements. The syntax for applying box-sizing is straightforward, such as box-sizing: border-box;, and it can be set on any element that accepts width or height properties, including block-level and inline elements. The property is not inherited by default, meaning child elements revert to the initial content-box value unless explicitly overridden, though it computes to its specified value and supports discrete animation. For broader application, a common technique involves a universal selector like * { box-sizing: border-box; } to enforce the border-box model site-wide, simplifying fixed-width designs by ensuring padding and borders do not expand the element beyond its declared size. The border-box value offers advantages in creating intuitive layouts, particularly for components with variable padding or borders, as it aligns the total rendered size with developer expectations and reduces common sizing pitfalls. This approach gained traction partly due to its adoption in and later, which supported the property natively, echoing earlier non-standard behaviors in IE that treated dimensions more inclusively.

Historical Development

Origins and Standardization

The CSS box model originated as part of the foundational visual formatting concepts in Cascading Style Sheets (CSS) Level 1, a W3C Recommendation published on December 17, 1996. This specification, edited by and Bert Bos, introduced a simple box-oriented model where each formatted generates one or more rectangular boxes, comprising a content area surrounded by optional padding, border, and margin. The model's terminology and structure drew inspiration from visual formatting paradigms in , treating elements as boxes to enable precise control over layout and spacing in web documents. Lie, working at in 1994, initially proposed CSS as "Cascading HTML Style Sheets" to address the limitations of 's inline styling, with Bos contributing through collaborative development and browser implementations like . CSS Level 2, released as a W3C Recommendation on May 12, 1998, further formalized the box model's components, expanding on CSS1 by detailing the interactions of margins, , borders, and areas within the visual formatting model. Edited by , , and Chris Lilley, this specification integrated the box model more deeply with rendering engines, defining how boxes are generated from the document tree and laid out for visual media like screens and print. It emphasized the rectangular nature of boxes and their role in normal flow layout, providing a standardized for element dimensions that summed , , borders, and margins. Subsequent refinements appeared in CSS Level 2 Revision 1 (CSS 2.1), a W3C Recommendation dated June 7, 2011, which addressed ambiguities from earlier versions, particularly around margin collapsing—where adjoining vertical margins combine into a single value equal to the larger of the two. This revision, again edited by Lie and Bos among others, clarified exceptions to collapsing (such as for floated or absolutely positioned elements) to improve without altering the core box structure. Early adoption of the box model occurred with the release of major browsers supporting CSS1, including 4.0 in June 1997 and 4.0 in September 1997, which implemented partial rendering of box properties to enable styled layouts. These implementations integrated the model into their HTML engines, marking the transition from basic text-based web rendering to more sophisticated visual design.

Browser Compatibility Issues

One of the most prominent browser compatibility issues with the CSS box model arose in Internet Explorer 5 for Windows, released in 2000, which defaulted to a non-standard "border-box" interpretation. In this implementation, the specified width and height values included the element's padding and border, rather than applying only to the content area as defined by the W3C's content-box model in the CSS Level 1 specification. This violation meant that elements with added padding or borders would render with less content space than intended, leading to narrower effective content areas compared to the standard model. The impact of this bug was widespread, causing significant layout breakage in cross-browser websites during the early . For instance, a <div> styled with width: 200px; [padding](/page/Padding): 10px; [border](/page/Border): 1px solid black; would have a total rendered width of 200px in 5 (with content squeezed to 178px), but 222px in compliant browsers, resulting in unexpectedly wider boxes and misaligned layouts when viewed in . This discrepancy affected countless sites built assuming the W3C standard, exacerbating the challenges of in an era of inconsistent rendering engines. In contrast, other major browsers demonstrated earlier and more consistent adherence to the W3C content-box standard. 1.0, released in 2002 and the foundation for , implemented the box model correctly from its initial version, prioritizing standards compliance. Similarly, versions from 3.6 onward (starting around 1999) largely complied with the standard after initial testing and refinements, while , launched in 2003, followed the W3C model without the border-box deviation seen in IE. Detection and mitigation of these issues relied on DOCTYPE declarations to trigger rendering modes. In IE6 and later, a complete DOCTYPE (e.g., <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">) switched the browser to standards mode, enforcing the correct content-box model, whereas omitting or using an incomplete DOCTYPE activated quirks mode, emulating IE5's non-standard behavior for backward compatibility. IE5, however, remained locked in quirks mode regardless of DOCTYPE, making cross-browser testing essential.

Resolution and Workarounds

The W3C's revisions to the CSS 2.1 specification between 2007 and 2011 addressed ambiguities in the original CSS2 box model by clarifying that the default behavior uses the content-box sizing model, where and borders are added outside the specified and dimensions. These updates aimed to promote interoperability across user agents by standardizing the interpretation of box dimensions, while indirectly encouraging the use of the emerging box-sizing property (introduced in CSS3) for greater layout flexibility in implementations. Browser-specific fixes emerged to enforce standards-compliant rendering of the box model. In and later versions, including a strict DOCTYPE declaration at the beginning of documents triggers standards mode, which adopts the correct content-box model and avoids the quirks mode interpretation where and borders were included within the element's and . For earlier versions like IE5, developers employed the Tantek Celik box model hack, utilizing a voice-family declaration to target invalid CSS rules specifically to IE5/Windows, thereby supplying adjusted width values without affecting other browsers. Common developer workarounds targeted Internet Explorer's inconsistencies directly. The * selector , which IE6 and earlier versions interpreted due to their non-standard handling of selector, allowed authors to corrective styles like reduced widths or adjusted s exclusively to those browsers; , * [html](/page/HTML) .element { width: 90%; } could compensate for inflated sizes. Additional techniques included manual adjustments—subtracting and thicknesses from the declared width in IE-targeted rules—or employing fixed positioning hacks, such as wrapping elements in positioned containers to override quirks mode calculations. In modern practice, CSS reset stylesheets provide a proactive approach to ensure a consistent box model across browsers from the outset. Eric Meyer's Reset CSS, first published in and updated in , zeroes out default margins, , and on common elements (e.g., div, p, ul { margin: 0; padding: 0; border: 0; }), eliminating browser-specific defaults that could exacerbate box model discrepancies and allowing developers to build layouts on a uniform foundation.

Applications and Extensions

Replaced vs. Non-Replaced Elements

In the CSS box model, elements are classified as either replaced or non-replaced based on how their content and dimensions are determined. Non-replaced elements, such as <div> and <p>, derive their size from the flow and rendering of their internal , including text, child elements, and whitespace, which influences the overall width and height through content-driven calculations. In contrast, replaced elements, like <img> and <input type="image">, have their content substituted by external resources—such as images or embedded media—outside the scope of the CSS formatting model, granting them intrinsic dimensions (natural width and height) and often an intrinsic ratio () independent of CSS properties. This distinction affects how the box model layers—, padding, borders, and margins—are applied and computed for each type. Replaced elements exhibit specific adaptations in the box model to accommodate their external content. For instance, when rendered inline, the height of the inline includes the vertical padding and in addition to the , contributing to the line , while vertical margins do not affect the line and may overlap with adjacent inline . Additionally, if the height is set to auto, it defaults to the element's intrinsic , while width: auto uses the intrinsic width; if only one is specified, the intrinsic ratio scales the other accordingly. Non-replaced elements, however, compute auto s based solely on , without relying on predefined intrinsic sizes, leading to more variable sizing influenced by font metrics, child elements, and available space. Practical examples illustrate these differences in application. For images (<img>), the intrinsic dimensions from the source dictate the default size, enabling responsive scaling via properties like max-width: 100%, which constrains the width to the container while preserving the through the intrinsic ratio. Form inputs, such as <input type="image">, similarly use intrinsic sizing from their graphical representation, maintaining fixed s that resist distortion unless overridden by CSS like object-fit. These behaviors ensure replaced elements integrate seamlessly into layouts without requiring manual dimension adjustments. In modern layouts like flexbox and CSS Grid, replaced elements function as atomic units, where their intrinsic dimensions influence alignment, sizing, and distribution algorithms, often treating them as indivisible blocks that prioritize natural proportions over content reflow. This atomic nature simplifies positioning but requires careful handling of constraints, such as using object-fit to manage how the intrinsic content fills the styled box, enhancing predictability in complex designs.

Overflow Handling

The overflow property in CSS governs the handling of content that extends beyond an element's padding box, offering mechanisms to either display, clip, or enable scrolling for such excess material. As a shorthand property, it simultaneously sets the overflow-x and overflow-y properties, which manage horizontal and vertical overflow directions, respectively; a single value applies to both axes, while two values can specify them independently. The property accepts four primary values: visible (the default), hidden, scroll, and auto. When is set to visible, renders freely outside the padding box without any clipping or addition of scrollbars, allowing it to potentially overlap adjacent or extend into the layout. In contrast, clips all exceeding the padding box boundaries, rendering it invisible while still occupying space in the document flow, though programmatic access to the clipped remains available via scripting. The value also enforces clipping at the padding box but introduces scrollbars in both directions regardless of whether overflow occurs, ensuring consistent scrollable behavior and designating the as a scroll container. Similarly, clips to the padding box and adds scrollbars only when necessary—mimicking if overflow exists or otherwise—thus optimizing the by avoiding unnecessary UI elements. Within the CSS box model, the overflow property operates on the combined content and padding areas, with clipping defined precisely at the edge of the padding box, which encompasses the content box plus any padding but excludes borders and margins. For values other than visible, the property establishes a new block formatting context on the element, which isolates its internal layout—including containing any descendant floats—preventing them from escaping and affecting the outer document flow; this makes the element an overflow root, containing all scrolling or clipped effects within its boundaries. Practical applications of [overflow](/page/overflow) include designing scrollable containers for variable-length content, such as navigation menus or content panels, where auto or scroll values provide intuitive user interaction without disrupting the overall . Another key use is employing hidden to avert layout disruptions from oversized elements, like constraining images or text blocks within fixed dimensions to maintain structural integrity in responsive designs.

References

  1. [1]
    Box model - W3C
    The CSS box model describes the rectangular boxes that are generated for elements in the document tree and laid out according to the visual formatting model.
  2. [2]
    CSS Basic User Interface Module Level 3 (CSS3 UI)
    ### Definition and Description of the `box-sizing` Property
  3. [3]
    Visual formatting model
    ### Summary of Visual Formatting Model and Box Model Contribution to Predictable Layout
  4. [4]
    Cascading Style Sheets, level 1 - W3C
    CSS1 assumes a simple box-oriented formatting model where each formatted element results in one or more rectangular boxes. (Elements that have a 'display' ...Abstract · Terminology · 'font-weight' · Box properties
  5. [5]
  6. [6]
  7. [7]
  8. [8]
  9. [9]
    CSS Box Model Module Level 4 - W3C
    Aug 4, 2024 · The CSS Box Model has a content area, padding, border, and margin. The CSS box model uses margin and padding properties to create spacing.The CSS Box Model · Margins · Padding · Conformance
  10. [10]
    Introduction to the CSS box model - CSS | MDN
    ### Summary of Content Area in CSS Box Model
  11. [11]
    CSS Inline Layout Module Level 3 - W3C
    Dec 18, 2024 · This module describes box model for this inline layout model and defines the block-axis alignment and sizing of inline-level content, extending ...<|control11|><|separator|>
  12. [12]
    Box model
    ### Summary of Padding in CSS Box Model (W3C CSS2 Spec)
  13. [13]
  14. [14]
    CSS box model - MDN Web Docs
    the content, padding, border, and margin — work together to create a box as displayed by CSS.Missing: diagram | Show results with:diagram
  15. [15]
  16. [16]
  17. [17]
  18. [18]
  19. [19]
  20. [20]
  21. [21]
  22. [22]
  23. [23]
    Box model
    ### Summary of Margin Collapsing in CSS (Section 8.3.1)
  24. [24]
  25. [25]
  26. [26]
  27. [27]
  28. [28]
  29. [29]
  30. [30]
  31. [31]
  32. [32]
  33. [33]
  34. [34]
  35. [35]
    CSS Box Model - Devopedia
    Oct 14, 2020 · Source: Lie and Bos 1996, sec. 4.1. W3C publishes Cascading Style Sheets, level 1, simply called CSS1, to express styling of HTML documents. It ...
  36. [36]
    A brief history of CSS until 2016 - W3C
    Dec 17, 2016 · The saga of CSS starts in 1994. Håkon Wium Lie works at CERN – the cradle of the Web – and the Web is starting to be used as a platform for electronic ...
  37. [37]
    8 Box model - W3C
    The CSS box model describes the rectangular boxes that are generated for elements in the document tree and laid out according to the visual formatting model. ...
  38. [38]
    Cascading Style Sheets, level 2 (CSS2) Specification - W3C
    May 12, 1998 · The CSS2 specification is available in the following formats: HTML: http://www.w3.org/TR/1998/REC-CSS2-19980512. a plain text file:
  39. [39]
    Box model
    ### Summary of Refinements to Box Model, Margin Collapsing, Publication Date, and Editors
  40. [40]
    Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification
    CSS 2.1 is a style sheet language that allows authors and users to attach style (eg, fonts and spacing) to structured documents (eg, HTML documents and XML ...
  41. [41]
    Netscape Communicator 4.01 in 1997 - Web Design Museum
    In June 1997, Netscape released Netscape Communicator 4.0, a web application suite. It included Netscape Navigator 4.0 web browser with CSS 1 support.
  42. [42]
    Internet Explorer version history - Wikipedia
    It was the first major browser with CSS support, although this support was only partial. ... Microsoft Internet Explorer 4, released on September 22, 1997, ...Microsoft Internet Explorer 4 · Windows Internet Explorer 9 · Internet Explorer 10
  43. [43]
    Quirks mode and strict mode - CSS
    Although IE 5 Windows mended quite a lot of IE 4 bugs, it perpetuated other glitches in CSS (mainly the box model). To make sure that their websites ...
  44. [44]
    IE's Top 10 CSS Problems - The Web Standards Project
    Nov 13, 1998 · The box model. Of all the problems CSS authors face, most vexing by far is the incomplete implementation of the box model. The box model ...
  45. [45]
    10 Fixes That Solve IE6 Problems - SitePoint
    Feb 29, 2024 · Here are 10 fixes to solve the majority of IE6 problems with valid HTML and CSS code. 1. Use a DOCTYPE You should always place a DOCTYPE at the top of every ...
  46. [46]
    Box Model Hack
    ... CSS Hacks And Other Good Intentions - background and philosophy on CSS hacks. Five Year Hackiversaries - history and development of the Box Model Hack. Valid ...
  47. [47]
    Internet Explorer and the CSS box model | 456 Berea Street
    Dec 21, 2006 · Use CSS hacks. Finally you can also use a CSS hack to supply modified values to IE 5.*/Win. I recommend avoiding CSS hacks as much as possible ...
  48. [48]
    IE CSS Bugs That'll Get You Every Time
    Oct 19, 2013 · Here are that major bugs in IE that'll get you every time: The Box Model This is perhaps the most common and frustrating bug of all in IE 6 and below.Missing: details | Show results with:details
  49. [49]
    Resetting Again – Eric's Archived Thoughts - meyerweb.com
    Jan 15, 2008 · Meyer has updated his reset CSS styles again. For those that don't know, these reset CSS styles so you have a consistent starting […] Very Nice ...Missing: enforce | Show results with:enforce
  50. [50]
    Replaced elements - Glossary - MDN Web Docs
    Jul 11, 2025 · Replaced elements are HTML elements whose content are replaced by external resources or content defined outside of the document structure.
  51. [51]
    10 Visual formatting model details - W3C
    If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic width, then that intrinsic width is the used value of 'width'.
  52. [52]
    Styling replaced elements - CSS | MDN
    ### Summary of CSS Box Model for Replaced Elements
  53. [53]
  54. [54]
  55. [55]
    CSS Overflow Module Level 3
    ### Summary of `overflow` Property (CSS Overflow Module Level 3)
  56. [56]
  57. [57]
  58. [58]