Category Archives: My solutions

How to style Gradient Border Color

Again CSS3! Proof that how to use style based websites in state of image-less. In the past, the use of the image was inevitable when it comes to showing gradient colors. Today, it becomes much cleaner with the use of CSS3 Gradient Border color.
Following I have made a little example by applying CSS3 Gradient border color. Well, let’s see how the trick works.

CSS Gradient Border
CSS Gradient Border

The DOM

 <div class="contianer">
 <h2 class="box-header">Gradient Borders</h2>
 <div class="box-wrap">
 <div class="box top">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>
 <div class="box right">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>
 <div class="box bottom">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>
 <div class="box left">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>
 </div>
</div>

The CSS

         * {
            margin: 0px;
            padding: 0px;
        }

        .contianer {
            width: 800px;
            margin: 0px auto;
        }

        .box-header {
            padding: 5px 0px;
            margin: 20px 0px;
            border-bottom: 5px solid transparent;
	        border-image: linear-gradient(to right, #0099CC 0%, #F27280 100%);
	        border-image-slice: 1
        }

        .box-wrap {
            display: flex;
            flex-wrap: wrap;
        }

        .box {
            flex-basis: 0;
            flex-grow: 1;
            background: #F6F6F6;
            min-width: 300px;
            color: #000;
            padding: 10px;
            margin: 10px;

            /*CSS for gradient border*/
            border: 5px solid transparent;
        }

        .box.top {
	    /*CSS for gradient border*/
	    border-image: linear-gradient(to top, #0099CC 0%, #F27280 100%);
            border-image-slice: 1;
        }

        .box.right {
	    /*CSS for gradient border*/
	    border-image: linear-gradient(to right, #0099CC 0%, #F27280 100%);
            border-image-slice: 1;
        }

        .box.bottom {
	    /*CSS for gradient border*/
	    border-image: linear-gradient(to bottom, #0099CC 0%, #F27280 100%);
            border-image-slice: 1;
        }

        .box.left {
	    /*CSS for gradient border*/
	    border-image: linear-gradient(to left, #0099CC 0%, #F27280 100%);
            border-image-slice: 1;
        }

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;
}

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;
}