Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk3 min

How to Force Two DIVs to Start on Separate Lines in HTML and CSS

Two DIVs normally stack vertically. If they do not, inspect display, flexbox, grid, floats, and positioning, then apply the layout-specific CSS fix.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Two consecutive <div> elements already start on separate lines in normal document flow: a div generates a block box, so the next block is laid out below it. If they appear side by side, a CSS rule or the parent’s layout context is changing that behavior. Inspect the computed styles, then apply the fix that matches the layout.

When normal block flow is the right fix

In ordinary horizontal writing mode, an element with display: block occupies its own line and causes the following block box to begin below it. The HTML tag alone does not guarantee that appearance, because CSS can change an element’s display value. See MDN’s display property reference and MDN’s guide to block and inline layout.

As an Amazon Associate I earn from qualifying purchases.

<div class="item">First</div>
<div class="item">Second</div>
.item {
  display: block;
}

Remove rules such as display: inline or display: inline-block if those elements should form a vertical sequence. Also check whether a float or positioning rule is taking an element out of normal flow.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If the parent is a flex container

A parent with display: flex establishes a flex layout for its direct children. Flexbox uses row as its default direction, which places the two divs next to each other. Set the parent to a column direction to stack them:

#1 Best Overall
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option
.container {
  display: flex;
  flex-direction: column;
}

.item {
  display: block;
}

flex-direction: column lays flex items along the container’s block axis. The property’s behavior and values are documented in MDN’s flex-direction reference.

If the parent is a grid container

A parent with display: grid uses grid tracks and item placement rather than ordinary block-flow sibling rules. Inspect the grid definition and placement in DevTools. For a simple one-column layout, define one column:

.container {
  display: grid;
  grid-template-columns: 1fr;
}

If explicit grid-column, grid-row, or multiple columns place the items side by side, adjust those declarations instead of adding a line-break element.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick browser-DevTools diagnosis

  1. Select the first div and the second div in the Elements panel.
  2. In Computed styles, check each element’s display, float, and position values.
  3. Inspect the immediate parent’s computed display. If it is flex, check flex-direction; if it is grid, inspect columns, rows, and placement.
  4. Disable suspicious rules one at a time. The layout should return to a vertical stack when the rule changing participation or placement is removed.

Why adding <br> is usually the wrong solution

The <br> element represents a meaningful line break inside text, such as a postal address or a poem. It is not a general-purpose layout control. Use the layout system—block flow, flexbox, or grid—to position separate containers. MDN describes the element at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/br.

Common causes and matching fixes

What you find Why the DIVs are side by side Appropriate fix
display: inline or inline-block The elements participate in an inline formatting context. Restore display: block or remove the overriding rule.
Parent has display: flex Flexbox defaults to a horizontal row. Set flex-direction: column on the parent.
Parent has display: grid Grid tracks or explicit placement use separate columns. Use one column or correct the grid item placement.
Float declarations Floats allow later content to flow alongside them. Remove the float or clear it where appropriate.
Absolute or fixed positioning The element is removed from normal flow. Use normal flow, or deliberately set non-overlapping offsets.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Minimal examples

Normal flow

<div class="box">One</div>
<div class="box">Two</div>

.box {
  display: block;
}

Vertical flex layout

<div class="stack">
  <div>One</div>
  <div>Two</div>
</div>

.stack {
  display: flex;
  flex-direction: column;
}

The original SitePoint thread’s code is unavailable, so no single original cause can be identified. The parent layout and computed styles determine which branch applies.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.