Pure css ‘Pinterest Design’

Pinterest is a great concept in web design to keep cards in nice alignment. Now in CSS/CSS3 world we can easily build it with pure css even without single line code of JS. Following, I am writing very simple code structure to show cards in ‘Pinterest Design’.

pinterest-design
pinterest-design

DOM Structure

<section class="pinterest_design">
 <h2 class="pinterest_design--title">Pinterest Design</h2>
 <ul class="pinterest_design--columns">
 <li class="pinterest_design--pin">
 <h3 class="pinterest_design--pin-title">What is Lorem Ipsum?</h3>
 <p class="pinterest_design--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="pinterest_design--pin">
 <h3 class="pinterest_design--pin-title">Why do we use it?</h3>
 <p class="pinterest_design--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="pinterest_design--pin">
 <h3 class="pinterest_design--pin-title">Where does it come from?</h3>
 <p class="pinterest_design--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="pinterest_design--pin">
 <h3 class="pinterest_design--pin-title">Where can I get some?</h3>
 <p class="pinterest_design--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="pinterest_design--pin">
 <h3 class="pinterest_design--pin-title">The standard Lorem Ipsum passage, used since the 1500s</h3>
 <p class="pinterest_design--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>
 <li class="pinterest_design--pin">
 <h3 class="pinterest_design--pin-title">1914 translation by H. Rackham</h3>
 <p class="pinterest_design--pin-body">"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth,"</p>
 </li>
 </ul>
</section>

CSS

 * {
    margin: 0;
    padding: 0;
}
            
.pinterest_design {
    width: 50%;
    margin: auto;
}
            
.pinterest_design--title {
    margin: 30px 0px;
}
            
.pinterest_design--columns {
    column-width: 320px;
    column-gap: 15px;
}
            
.pinterest_design--pin {
    display: inline-block;
    width: 100%;
    margin-bottom: 15px;
}
            
.pinterest_design--pin-title {
    background-color: #006FC4;
    color: #ffffff;
    padding: 10px 20px;
}
            
.pinterest_design--pin-body {
    background-color: #dddddd;
    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