How to Divide Text Into Two Columns Layout using CSS ?
Last Updated :
15 Jul, 2025
Dividing text into two-column layouts using CSS allows for a more structured and visually appealing content presentation. It helps break long text into manageable sections, improving readability and user experience. By using CSS techniques, you can easily create balanced and organized multi-column designs.
Here we have some common approaches to dividing text into two-column layouts using CSS :
Approach 1: Dividing Text Into Two Columns Using column-count Property
Using the column-count property in CSS divides content into a specified number of columns. By setting column-count: 2, the content automatically splits into two columns, creating a balanced layout. This approach improves readability, especially for large blocks of text.
Syntax
column-count: number|auto|initial|inherit;
Example: In this example, we use the column-count CSS property to divide text in the div element into two columns. It ensures a 30px gap between columns for better readability.
HTML
<!DOCTYPE html>
<html>
<head>
<style>
body {
text-align: center;
color: green;
}
.GFG {
column-count: 2;
column-gap: 30px;
/* Adjust the gap between columns */
}
</style>
</head>
<body>
<h1>
How to divide the text in the division
element into two columns using CSS?
</h1>
<div class="GFG">
<h2>Welcome to the world of Geeks!!</h2>
<p>
How many times were you frustrated while
looking out for a good collection of
programming/algorithm/interview questions?
What did you expect and what did you get?
This portal has been created to provide well
written, well thought, and well-explained
solutions for selected questions.
</p>
<p>
<strong>Our team includes:</strong>
</p>
<p>
Sandeep Jain: An IIT Roorkee alumnus
and founder of GeeksforGeeks. He loves
to solve programming problems in the most
efficient ways. Apart from GeeksforGeeks,
he has worked with DE Shaw and Co. as a
software developer and JIIT Noida as an
assistant professor.
</p>
<p>
Vaibhav Bajpai: Amazed by computer
science, he is a technology enthusiast who
enjoys being a part of development. Off
from work, you can find him in love with
movies, food, and friends.
</p>
<p>
Shikhar Goel: A Computer Science graduate
who likes to make things simpler. When he's
not working, you can find him surfing the web,
learning facts, tricks, and life hacks.
He also enjoys movies in his leisure time.
</p>
<p>
Dharmesh Singh: A software developer who
is always trying to push boundaries in search
of great breakthroughs. Off from his desk,
you can find him cheering up his buddies
and enjoying life.
</p>
<p>
Shubham Baranwal: A passionate developer
who always tries to learn new technology and
software. In his free time, either he reads
some articles or learns some other stuff.
</p>
</div>
</body>
</html>
Output:
Approach 2: Dividing Text Into Two Columns Using flexbox
Using the Flexbox approach, you can divide content into two columns by setting display: flex on the container and assigning each child element a width: 50%. This layout creates two evenly spaced columns, providing flexibility and better control over content arrangement.
Syntax
display: flex;
gap: 20px;
/* Adjust space between columns */
Example: In this example we creates a two-column layout using Flexbox. The flex-container class divides the content into two equal columns with a 20px gap, ensuring balanced and responsive content presentation.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width,
initial-scale=1.0">
<title>Two Columns Layout using Flexbox</title>
<style>
.flex-container {
display: flex;
gap: 20px;
/* Adjust space between columns */
}
.column {
width: 50%;
/* Each column takes up 50% of the container width */
}
</style>
</head>
<body>
<h1>divide the text into two columns using Flexbox?</h1>
<div class="flex-container">
<div class="column">
<p>Welcome to the world of Geeks!!</p>
<p>How many times were you frustrated
while looking for a good collection
of programming/algorithm/interview
questions?
</p>
</div>
<div class="column">
<p>This portal has been created to provide
well-thought and well-explained solutions
for selected questions.
</p>
<p>Our team includes Sandeep Jain, Vaibhav Bajpai,
Shikhar Goel, Dharmesh Singh, and Shubham
Baranwal, all
passionate developers and engineers.
</p>
</div>
</div>
</body>
</html>
Output:
Using flexbox Example output
Similar Reads
JavaScript Tutorial JavaScript is a programming language used to create dynamic content for websites. It is a lightweight, cross-platform, and single-threaded programming language. It's an interpreted language that executes code line by line, providing more flexibility.JavaScript on Client Side: On the client side, Jav
11 min read
React Interview Questions and Answers React is an efficient, flexible, and open-source JavaScript library that allows developers to create simple, fast, and scalable web applications. Jordan Walke, a software engineer who was working for Facebook, created React. Developers with a JavaScript background can easily develop web applications
15+ min read
React Tutorial React is a powerful JavaScript library for building fast, scalable front-end applications. Created by Facebook, it's known for its component-based structure, single-page applications (SPAs), and virtual DOM,enabling efficient UI updates and a seamless user experience.Note: The latest stable version
7 min read
JavaScript Interview Questions and Answers JavaScript is the most used programming language for developing websites, web servers, mobile applications, and many other platforms. In Both Front-end and Back-end Interviews, JavaScript was asked, and its difficulty depends upon the on your profile and company. Here, we compiled 70+ JS Interview q
15+ min read
Domain Name System (DNS) DNS is a hierarchical and distributed naming system that translates domain names into IP addresses. When you type a domain name like www.geeksforgeeks.org into your browser, DNS ensures that the request reaches the correct server by resolving the domain to its corresponding IP address.Without DNS, w
8 min read
NodeJS Interview Questions and Answers NodeJS is one of the most popular runtime environments, known for its efficiency, scalability, and ability to handle asynchronous operations. It is built on Chromeâs V8 JavaScript engine for executing JavaScript code outside of a browser. It is extensively used by top companies such as LinkedIn, Net
15+ min read
HTML Interview Questions and Answers HTML (HyperText Markup Language) is the foundational language for creating web pages and web applications. Whether you're a fresher or an experienced professional, preparing for an HTML interview requires a solid understanding of both basic and advanced concepts. Below is a curated list of 50+ HTML
14 min read
CSS Tutorial CSS stands for Cascading Style Sheets. It is a stylesheet language used to style and enhance website presentation. CSS is one of the three main components of a webpage, along with HTML and JavaScript.HTML adds Structure to a web page.JavaScript adds logic to it and CSS makes it visually appealing or
7 min read
Top 10 Projects For Beginners To Practice HTML and CSS Skills Learning to code is an exciting journey, especially when stepping into the world of programming with HTML and CSSâthe foundation of every website you see today. For most beginners, these two building blocks are the perfect starting point to explore the creative side of web development, designing vis
8 min read
Node.js Tutorial Node.js is a powerful, open-source, and cross-platform JavaScript runtime environment built on Chrome's V8 engine. It allows you to run JavaScript code outside the browser, making it ideal for building scalable server-side and networking applications.JavaScript was mainly used for frontend developme
4 min read