Skip to content

Instantly share code, notes, and snippets.

@AndreaBarghigiani
Created January 14, 2018 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndreaBarghigiani/05e88547cf3281b26a3d340ba0477dd7 to your computer and use it in GitHub Desktop.
Save AndreaBarghigiani/05e88547cf3281b26a3d340ba0477dd7 to your computer and use it in GitHub Desktop.
Questi codici sono stati usati nell'articolo Interessanti layout che puoi creare oggi grazie a FlexBox che puoi trovare qua: https://skillsandmore.org/flexbox-layout/
.flex-container {
display: flex;
flex-flow: column nowrap; /* scorciatoia flex-direction e flex-wrap */
align-content: center;
height: auto;
}
.flex-item {
flex: 0 0 auto; /* scorciatoia flex-grow flex-shrink flex-basis */
width: 100%;
margin: .25em;
padding: .5em;
}
@media screen and (min-width: 40.5em) {
.flex-container {
flex-flow: column wrap; /* attivo le colonne */
height: 58em;
}
.flex-item { width: 50%; /* 2 col */ }
}
@media screen and (min-width: 60.5em) {
.flex-container { height: 43em; }
.flex-item { width: 33.333%; /* 3 col */ }
}
<section class="flex-container">
<div class="flex-item">1</div>
<div class="flex-item">2</div>
<div class="flex-item">3</div>
<div class="flex-item">4</div>
<div class="flex-item">5</div>
<div class="flex-item">6</div>
<div class="flex-item">7</div>
<div class="flex-item">8</div>
</section>
.layout-flex {
display: flex;
align-items: flex-end;
}
.layout-flex .small { order: -1; }
.layout-flex .stretch-title {
flex: 1;
margin-bottom: 4.5rem;
border-bottom: 1px solid #ccc;
}
<div class="layout-flex">
<h2 class="stretch-title">looks great from here to there</h2>
<div class="stretch-photo small"><img src="img/flexbox_stretch_small.png" alt="mobile" /></div>
<div class="stretch-photo big"><img src="img/flexbox_stretch_big.png" alt="desktop" /></div>
</div>
.flex-split {
flex-direction: row;
}
.flex-split &gt; div {
justify-content: center;
text-align: center;
width: 50%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment