Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP C C++ C# AWS W3.CSS HOW TO BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING INTRO TO HTML & CSS BASH RUST TOOLS

W3.CSS Rows

Simple Responsive Rows

W3.CSS provides simple classes for dividing a row into halves, thirds, and quarters.

The columns automatically stack on small screens.

Row Classes

Class Description
w3-row Creates a row with no column padding
w3-row-padding Creates a row with padding between the columns

Column Classes

Class Width
w3-half 1/2
w3-third 1/3
w3-twothird 2/3
w3-quarter 1/4
w3-threequarter 3/4
w3-rest Uses the remaining width

Mobile First Responsiveness

On screens smaller than 601 pixels, the fraction classes become full width.


Two Equal Columns

The w3-half class divides a row into two equal columns.

The width of the class is 1/2 of the parent element (50%).

On screens smaller than 601 pixels, it resizes to 100%.

w3-half

w3-half

Example

<div class="w3-row">
  <div class="w3-half w3-container w3-blue">w3-half</div>
  <div class="w3-half w3-container w3-light-blue">w3-half</div>
</div>
Try it Yourself »

Three Equal Columns

The w3-third class divides a row into three equal columns.

The width of the w3-third class is 1/3 of the parent element (33.33%).

On screens smaller than 601 pixels, it resizes to 100%.

w3-third

w3-third

w3-third

Example

<div class="w3-row">
  <div class="w3-third w3-container w3-blue">w3-third</div>
  <div class="w3-third w3-container w3-light-blue">w3-third</div>
  <div class="w3-third w3-container w3-blue">w3-third</div>
</div>
Try it Yourself »

Two Thirds and One Third

Fraction classes can be combined in the same row.

On screens smaller than 601 pixels they all resize to 100%.

2/3

1/3

Example

<div class="w3-row">
  <div class="w3-twothird w3-container w3-blue">2/3</div>
  <div class="w3-third w3-container w3-light-blue">1/3</div>
</div>
Try it Yourself »

Four Equal Columns

The w3-quarter class divides a row into four equal columns.

1/4

1/4

1/4

1/4

Example

<div class="w3-row w3-center">
  <div class="w3-quarter">1/4</div>
  <div class="w3-quarter">1/4</div>
  <div class="w3-quarter">1/4</div>
  <div class="w3-quarter">1/4</div>
</div>
Try it Yourself »


Rows with Padding

The w3-row-padding class adds space between the columns.

Example

<div class="w3-row-padding">
  <div class="w3-third"><img src="img_lights.jpg"></div>
  <div class="w3-third"><img src="img_nature.jpg"></div>
  <div class="w3-third"><img src="img_snowtops.jpg"></div>
</div>
Try it Yourself »

Without Padding:

Use w3-row when you want the columns to touch.

Use w3-row-padding when you want space between the columns.


Stretched Padded Rows

The w3-stretch class removes the outer margins from a padded row.

Example

<div class="w3-row-padding w3-stretch">
  <div class="w3-third">...</div>
  <div class="w3-third">...</div>
  <div class="w3-third">...</div>
</div>
Try it Yourself »

Using the Remaining Width

The w3-rest class uses the width left after the other columns.

150px

Remaining width

Example

<div class="w3-row">
  <div class="w3-col" style="width:150px">150px</div>
  <div class="w3-rest">Remaining width</div>
</div>
Try it Yourself »

Flexbox can also create this type of layout with flex:1.


Nested Rows

A row can be placed inside a column.

1/2

1/2

1/2

1/2

Example

<div class="w3-row">

  <div class="w3-half">
    <div class="w3-row">
      <div class="w3-half">1/2</div>
      <div class="w3-half">1/2</div>
    </div>
  </div>

  <div class="w3-half">1/2</div>

</div>
Try it Yourself »

Rows vs Flexbox vs Grid

W3.CSS provides several ways to create layouts.

Layout Best For
Rows Simple halves, thirds, and quarters
Flexbox Arranging and aligning items in one direction
Grid Flexible layouts with rows and columns

Rows are useful when you want a simple predefined fraction without writing additional CSS.

Flexbox and Grid provide more control for modern layouts.


What You Have Learned

  • w3-row creates a row without column padding
  • w3-row-padding adds space between columns
  • w3-half creates half-width columns
  • w3-third and w3-twothird create third-based columns
  • w3-quarter and w3-threequarter create quarter-based columns
  • w3-rest uses the remaining width
  • Fraction columns automatically stack on small screens

More Examples

Explore more ways to use W3.CSS rows.


Combinations

w3-quarter

w3-half

w3-quarter


w3-quarter

w3-quarter

w3-half


w3-half

w3-quarter

w3-quarter


w3-third

w3-twothird


w3-quarter

w3-threequarter


Custom Column Widths

The w3-col class can be combined with CSS widths.

20%

60%

20%

Example

<div class="w3-row">
  <div class="w3-col" style="width:20%">20%</div>
  <div class="w3-col" style="width:60%">60%</div>
  <div class="w3-col" style="width:20%">20%</div>
</div>
Try it Yourself »

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2026 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.