Flexible Flex Card

Indeed CSS3 is awesome! and It has been proved again. Especially display Flex. The following component about ‘Flexible Flex Card’. Yes, display Flex make it so easier, now we can achieve complex requirements easily only by CSS even without single line code of JS.

The HTML

 <section class="flexible-flex-card">
 <h2 class="flexible-flex-card--title">If one card</h2>
 <ul class="flexible-flex-card--columns">
 <li class="flexible-flex-card--pin">
 <h3 class="flexible-flex-card--pin-title">What is Lorem Ipsum?</h3>
 <p class="flexible-flex-card--pin-body">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. when an unknown printer took a galley of type and scrambled it to make a type specimen book</p>
 </li>
 </ul>
 
 <hr class="flexible-flex-card--divider">
 
 <h2 class="flexible-flex-card--title">If two cards</h2>
 <ul class="flexible-flex-card--columns">
 <li class="flexible-flex-card--pin">
 <h3 class="flexible-flex-card--pin-title">What is Lorem Ipsum?</h3>
 <p class="flexible-flex-card--pin-body">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. when an unknown printer took a galley of type and scrambled it to make a type specimen book</p>
 </li>
 <li class="flexible-flex-card--pin">
 <h3 class="flexible-flex-card--pin-title">Why do we use it?</h3>
 <p class="flexible-flex-card--pin-body">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here'</p>
 </li>
 </ul>
 
 <hr class="flexible-flex-card--divider">
 
 <h2 class="flexible-flex-card--title">If three cards</h2>
 <ul class="flexible-flex-card--columns">
 <li class="flexible-flex-card--pin">
 <h3 class="flexible-flex-card--pin-title">What is Lorem Ipsum?</h3>
 <p class="flexible-flex-card--pin-body">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. when an unknown printer took a galley of type and scrambled it to make a type specimen book</p>
 </li>
 <li class="flexible-flex-card--pin">
 <h3 class="flexible-flex-card--pin-title">Why do we use it?</h3>
 <p class="flexible-flex-card--pin-body">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here'</p>
 </li>
 <li class="flexible-flex-card--pin">
 <h3 class="flexible-flex-card--pin-title">Where does it come from?</h3>
 <p class="flexible-flex-card--pin-body">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. </p>
 </li>
 </ul>
 
 <hr class="flexible-flex-card--divider">
 
 <h2 class="flexible-flex-card--title">If multiple cards</h2>
 <ul class="flexible-flex-card--columns">
 <li class="flexible-flex-card--pin">
 <h3 class="flexible-flex-card--pin-title">What is Lorem Ipsum?</h3>
 <p class="flexible-flex-card--pin-body">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. when an unknown printer took a galley of type and scrambled it to make a type specimen book</p>
 </li>
 <li class="flexible-flex-card--pin">
 <h3 class="flexible-flex-card--pin-title">Why do we use it?</h3>
 <p class="flexible-flex-card--pin-body">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here'</p>
 </li>
 <li class="flexible-flex-card--pin">
 <h3 class="flexible-flex-card--pin-title">Where does it come from?</h3>
 <p class="flexible-flex-card--pin-body">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. </p>
 </li>
 <li class="flexible-flex-card--pin">
 <h3 class="flexible-flex-card--pin-title">Where can I get some?</h3>
 <p class="flexible-flex-card--pin-body">There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable.</p>
 </li>
 <li class="flexible-flex-card--pin">
 <h3 class="flexible-flex-card--pin-title">The standard Lorem Ipsum passage, used since the 1500s</h3>
 <p class="flexible-flex-card--pin-body">"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. "</p>
 </li>
 </ul>
 </section>

The CSS

 * {
    margin: 0;
    padding: 0;
}
            
.flexible-flex-card {
    width: 700px;
    margin: auto;
}
            
.flexible-flex-card--title {
    margin: 30px 0px;
}

.flexible-flex-card--divider {
    height: 1px;
    background: #DDD;
    margin: 20px 0px;
}
            
.flexible-flex-card--columns {
    margin: 0px;
    padding: 0px;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}
            
.flexible-flex-card--pin {
    background-color: #dddddd;
    min-width: 200px;
    margin: 0px 15px 15px 0px;
    flex-basis: 0;
    flex-grow: 1;
}
            
.flexible-flex-card--pin-title {
    background-color: #006FC4;
    color: #fff;
    padding: 10px 20px;
}
            
.flexible-flex-card--pin-body {
    padding: 10px 20px;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s