A wrapper is an informal name for an element used to group other content. There is no wrapper element or special wrapper behavior in HTML. The right element depends on what the group means.
Use a div for a layout-only group
The div constrains width and centers the paragraph. It does not create a landmark or section heading. The CSS supplies the layout.
HTML and CSS
HTML
<div class="wrapper"><p>A readable column within a wider page.</p></div>
CSS
.wrapper {
max-width: 30rem;
margin-inline: auto;
padding: 1rem;
border: 1px solid #94a3b8;
}
Edit HTML or CSS to update the preview as you type. Copy code snippet copies the selected tab. Preview spacing and font defaults are not included.
Choose meaning before styling
Use main for the page’s dominant content, nav for a navigation section, article for independently meaningful content, and section for a thematic section normally identified by a heading. Do not choose section simply to get a block box; div is appropriate for a generic grouping.
Span groups phrasing content within a sentence. It is useful when a few words need a class or language attribute without a different semantic element. Do not wrap block content in span merely to avoid a line break.
A wrapper does not guarantee a width
Div and section normally use block display, but an explicit width, positioning, flex/grid participation, or changed display can alter their size. They do not always occupy the full viewport. CSS display does not change an element’s HTML content model: turning div into inline does not make it valid inside a paragraph where its markup is otherwise invalid.
Avoid unnecessary nesting that complicates selectors and spacing. Add a wrapper when it gives a real grouping, layout boundary, or semantic structure. Then test the resulting reading order and width at a narrow viewport.
Learn display, inline versus block, and semantic HTML.
Sources
Reference 1 Reference 2 Reference 3 Reference 4 provide the technical details and current compatibility information.