How To Create A 3-column Layout Grid With CSS? - Studytonight
Có thể bạn quan tâm
The layout is very important while designing a website. CSS grid layout is used to add columns and rows to the webpage. We can add any number of columns or rows to the webpage. Lets us see how we can create a 3-column layout with CSS.
Using CSS flexbox
We can create a 3-column layout grid using CSS flexbox. Add the display: flex property to the container class. Set the flex percentage value to each column. Here for three-layer, we can set flex: 33.33%. In addition, use other CSS properties to customize the column.
Example: Create a 3-column layout grid with CSS
Here is a program to create a 3-column layout using flexbox properties. Both the column has equal width.
<!DOCTYPE html> <html lang="en"> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>HTML</title> <style> .column { flex: 33.33%; height: 200px; padding: 10px; margin: 5px; background-color: #cccccc; text-align: center; } .container { display: flex; } </style> </head> <body> <h2> 3-column grid layout</h2> <div class="container"> <div class="column"> <h2> First column </h2> <p> This is first column of our grid system</p> </div> <div class="column"> <h2> second column </h2> <p> This is second column of our grid system</p> </div> <div class="column"> <h2> Third column </h2> <p> This is third column of our grid system</p> </div> </div> </body> </html>Output
Here is the output of the above code.

Using CSS grid property
The grid property is used to layout major page areas or small user interfaces. We can create a grid of fixed track sizes. We can create columns by creating a grid container using display: grid. To add three columns use grid-template-columns. Specify the width of each column separated by white space. So we can add variable-width layout using grid property.
Conclusion
In this tutorial, we have learned to create three columns grid layout using CSS properties. It can be created using flexbox properties or grid properties. Grid properties can be used to create variable-width columns.
Từ khóa » Html Div Tag 3 Columns
-
How To Create A Three Column Layout - W3Schools
-
3 Column Layout HTML/CSS - Stack Overflow
-
HTML 3 Column Layout: A Comprehensive And Easy How-To Guide
-
How To Divide Div Into 3 Equal Columns Layout CSS - Dev Practical
-
How To Create A 3-column Layout Grid With CSS? - Tutorialspoint
-
Grid System - Bootstrap
-
CSS · Bootstrap
-
Divide 3 Divs In 3 Columns - HTML CSS CSS Layout
-
How To Create 3 Columns Oin Html Without Css?
-
CSS Layout Techniques | Comm244 Notes
-
How To Create Columns In HTML
-
Basic Concepts Of Grid Layout - CSS: Cascading Style Sheets | MDN
-
How To Create A Responsive 3 Column Layout Using Html And CSS ...
-
3 Column Layouts (Responsive Demos & Example HTML/CSS)