-
Hajipur, Bihar, 844101
CSS Multiple Columns allow you to divide content (mostly text) into multiple vertical columns, similar to what you see in newspapers or magazines. This improves readability for long texts and helps utilize screen space efficiently.
It is achieved using the Multi-column Layout Module in CSS.
Property | Description |
---|---|
column-count |
Specifies the number of columns |
column-width |
Specifies the width of each column |
column-gap |
Space between columns |
column-rule |
Adds a line between columns |
column-span |
Makes an element span across all columns (like a heading) |
<div class="multicolumn">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent vel arcu a nisl aliquet suscipit.</p>
</div>
.multicolumn {
column-count: 3;
column-gap: 20px;
}
.multicolumn {
column-count: 2;
column-gap: 30px;
column-rule: 1px solid #ccc;
}
.heading {
column-span: all;
font-weight: bold;
font-size: 20px;
}
<div class="multicolumn">
<h2 class="heading">Chapter 1</h2>
<p>Content split into columns...</p>
</div>
@media (max-width: 600px) {
.multicolumn {
column-count: 1;
}
}
✅ Write CSS for the following:
Q1. Divide a paragraph into 3 columns using column-count
.
Q2. Create a 2-column layout with 40px gap between them.
Q3. Add a vertical line between columns using column-rule
.
Q4. Span a heading across all columns.
Q5. Create a responsive layout that shows 1 column on mobile.
Q6. Use column-width
to control individual column size.
Q7. Style columns with different background colors (with nested divs).
Q8. Align text properly in multi-column layout.
Q9. Add column-fill: balance;
to balance content.
Q10. Create multi-column layout inside a <section>
.
Q1: Which property sets the number of columns?
Q2: What does column-gap define?
Q3: What is column-rule used for?
Q4: How do you make a heading span across all columns?
Q5: What is the default value of column-gap?
Q6: Which property sets the minimum width of columns?
Q7: Can you use media queries with columns?
Q8: Which HTML element supports column layout?
Q9: How to balance content equally in columns?
Q10: What happens if content doesn’t fit all columns?