An Interest In:
Web News this Week
- April 2, 2024
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
January 25, 2022 11:46 am GMT
Original Link: https://dev.to/rootviper4/create-a-row-and-column-container-with-html-and-css-only-6li
Create a row and column container with HTML and CSS only.
To create a well shaped container using HTML and CSS only (no boostrap require ) you can use the following method (i will illustrate an example of 3 columns):
HTML CODE
<div class="container grid grid--3-cols"> <div class="div-one"> <p>Lorem ipsum tbum</p> </div> <div class="div-two"> <p>Lorem ipsum tbum</p> </div> <div class="div-three"> <p>Lorem ipsum tbum</p> </div></div>
CSS CODE
.container { max-width: 120rem; padding: 0 3.2rem; margin: 0 auto;}/* the gap gives the space between the columns */.grid { display: grid; column-gap: 6.4rem; row-gap: 9.6rem; }/* for 2 columns*/.grid--2-cols { grid-template-columns: repeat(2, 1fr);}/* for 3 columns*/.grid--3-cols { grid-template-columns: repeat(3, 1fr);}/* for 4 columns*/.grid--4-cols { grid-template-columns: repeat(4, 1fr);}
Original Link: https://dev.to/rootviper4/create-a-row-and-column-container-with-html-and-css-only-6li
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To