How to Create 3 Columns with CSS

You can use this CSS code to create a three-column layout. Simply add the appropriate HTML to create the column structure in your HTML document.

Programmazione CSS
Programmazione CSS
Follow FullPress on Google

Add us to your preferred sources.

Follow this source on Google

Here is an example of CSS code to create a three-column layout:

.container {
  display: flex;
  justify-content: space-between;
}

.column {
  flex-basis: 30%;
  padding: 20px;
  background-color: #f1f1f1;
  border: 1px solid #ccc;
}

/* Optional: Adjust layout for mobile devices */
@media screen and (max-width: 768px) {
  .container {
    flex-direction: column;
  }
  
  .column {
    flex-basis: 100%;
    margin-bottom: 20px;
  }
}

 

You can use this CSS code to create a three-column layout. Simply add the appropriate HTML to create the column structure in your HTML document.

For example, here is a simple HTML example that uses the three-column layout:

<div class="container">
  <div class="column">
    <h2>Column 1</h2>
    <p>Content of column 1</p>
  </div>
  <div class="column">
    <h2>Column 2</h2>
    <p>Content of column 2</p>
  </div>
  <div class="column">
    <h2>Column 3</h2>
    <p>Content of column 3</p>
  </div>
</div>

Make sure to link your CSS file to your HTML file using the <link> tag in your <head>.

Pubblicato in

Se vuoi rimanere aggiornato su How to Create 3 Columns with CSS iscriviti alla nostra newsletter settimanale

Be the first to comment

Leave a Reply

Your email address will not be published.


*