Search
 
SCRIPT & CODE EXAMPLE
 

CSS

responsive flexbox in css

.flex-container {
  display: flex;
  flex-direction: row;
}

/* Responsive layout - makes a one column layout instead of a two-column layout */
@media (max-width: 800px) {
  .flex-container {
    flex-direction: column;
  }
}
Comment

responsive flexbox

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
  box-sizing: border-box;
}

/* Container for flexboxes */
.row {
  display: flex;
  flex-wrap: wrap;
 
}

/* Create four equal columns */
.column {
  flex: 24%;
  padding: 20px;
   margin:4px;
}

/* On screens that are 992px wide or less, go from four columns to two columns */
@media screen and (max-width: 992px) {
  .column {
    flex: 48%;
  }
}

/* On screens that are 600px wide or less, make the columns stack on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
  .row {
    flex-direction: column;
  }
}
</style>
</head>
<body>

<h2>Responsive Four Column Layout with Flex</h2>
<p><strong>Resize the browser window to see the responsive effect.</strong> On screens that are 992px wide or less, the columns will resize from four columns to two columns. On screens that are 600px wide or less, the columns will stack on top of each other instead of next to eachother.</p>

<div class="row">
  <div class="column" style="background-color:#aaa;">
    <h2>Column 1</h2>
    <p>Some text..</p>
  </div>
  
  <div class="column" style="background-color:#bbb;">
    <h2>Column 2</h2>
    <p>Some text..</p>
  </div>
  
  <div class="column" style="background-color:#ccc;">
    <h2>Column 3</h2>
    <p>Some text..</p>
  </div>
  
  <div class="column" style="background-color:#ddd;">
    <h2>Column 4</h2>
    <p>Some text..</p>
  </div>
</div>

</body>
</html>


Comment

PREVIOUS NEXT
Code Example
Css :: html watermark background 
Css :: bootstrap ol 
Css :: docker postgres 
Css :: autocomplete background color css 
Css :: css remove outline 
Css :: center li in ul css 
Css :: how to make border for letters in css 
Css :: circle button css 
Css :: text shadow 
Css :: can we use material ui and tailwind css together 
Css :: border radius 4 values 
Css :: how to give text two colors in css 
Css :: css animation-iteration-count 
Css :: @keyframes 
Css :: input rtl html 
Css :: how to set fallback font in css 
Css :: css lighten function 
Css :: align div bottom of parent 
Css :: css grid span columns 
Css :: background clip text 
Css :: how to margin placeholdr text 
Css :: how to x axis scroll css 
Css :: css user-select 
Css :: can we use multiple keyframes in css 
Css :: how to add a linear gradient in css 
Css :: purgecss cli 
Css :: how to create a circle with css 
Css :: Disable text selection/highlight 
Css :: no break line html 
Css :: rotate keyframe animation 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =