How To Design Custom Pricing Plan Tables with HTML5 and CSS3

Tuesday, January 21, 2014


Advertise here with BSA




Any company selling a service with payment plans usually breaks up the structure into different packages. Smaller packages will cost less but also provide fewer features. Pricing tables are the perfect UI component to display these packages in an easy-to-compare design.


For this tutorial I want to demonstrate how we can create pricing tables with just a bit of HTML5 and CSS3. Despite the name, I haven’t actually used any <table> elements within the design. You might feel these are easier but they also depend on a rigid formulaic structure. Pricing tables can have many facets including service terms, plan details, pricing details, and of course the purchase/signup button.


custom designed html5 css3 pricing tables tutorial open source


Live Demo Download Source Code



Getting Started


This demonstration is mostly built around aesthetics so I haven’t even bothered touching the jQuery library. The document header references a single stylesheet named styles.css which imports an external web font Alegreya Sans.


Looking towards the internal table itself you will see it’s built using a container div, along with internal block elements like <header> and <section>. This makes everything easier to read when skimming through the code. And we can separate block sections from each table to distinguish between background colors and font styles.



<div id="pricing" class="clearfix">
<div class="price-table">
<header>
<h3>Basic</h3>
</header>
<section class="price-details">
<p>$19<span class="price-recur">per month</span></p>
</section>
<section class="details">
<ul class="details-list">
<li class="wizard">Easy Setup Wizard</li>
<li class="storage">250GB Storage</li>
<li class="scripts">Open Source Scripts</li>
<li class="support">24/7 Tech Support</li>
</ul>
</section>
<section class="purchase-btn"><a href="javascript:void(0);">Purchase</a></section>
</div><!-- @end "Basic" .price-table -->

To save room I’ve only copied the very first pricing table HTML for the “Basic” plan. The header section uses a background gradient plus a small text shadow to stand apart from the page. Pricing details are split using a span element with the class .price-recur. So the numeric cost will appear much larger than the denoted timeframe(per month).


You’ll also notice the .details-list contains list items with different classes. These each represent a different background icon from the Gentle Edges icon set. The PNGs are white by default which is perfect for this dark tabular color scheme.


The outer container #pricing uses a clearfix class to keep everything aligned properly. The tables are floated next to each other using fixed width values. These could be redefined to use flexible widths based on the container, if your layout is responsive. Basically you can adjust these numbers in CSS to get them aligned any way you’d like.


Typical CSS Styles


Each of the table designs follows the same class structure. Higher-priced tables have more listed icon features, and so they appear longer on the page.



/* page structure */
#w {
display: block;
width: 800px;
margin: 0 auto;
padding: 15px 10px;
background: #fff;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: 1px 2px 4px rgba(0,0,0,0.55);
-moz-box-shadow: 1px 2px 4px rgba(0,0,0,0.55);
box-shadow: 1px 2px 4px rgba(0,0,0,0.55);
}


#pricing {
display: block;
margin-bottom: 20px;
}

.price-table {
display: block;
float: left;
width: 185px;
text-align: center;
color: #fff;
background: #6f8590;
margin-right: 10px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}

Each inner table is fixed at 185px width. This comes out to 740px along with an extra 10px margin. The total body wrapper is 800px so these tables come in at just about the perfect width value. Also the table itself has rounded corners which are then translated to other elements such as the header.



.price-table header {
display: block;
padding: 15px 0;
border-bottom: 1px solid #54656d;
-webkit-border-top-right-radius: 5px;
-webkit-border-top-left-radius: 5px;
-moz-border-radius-topright: 5px;
-moz-border-radius-topleft: 5px;
border-top-right-radius: 5px;
border-top-left-radius: 5px;
background-color: #5f8597;
background-image: -webkit-gradient(linear, left top, left bottom, from(#324a56), to(#5f8597));
background-image: -webkit-linear-gradient(top, #324a56, #5f8597);
background-image: -moz-linear-gradient(top, #324a56, #5f8597);
background-image: -ms-linear-gradient(top, #324a56, #5f8597);
background-image: -o-linear-gradient(top, #324a56, #5f8597);
background-image: linear-gradient(top, #324a56, #5f8597);
}
.price-table header h3 {
font-size: 2.7em;
font-weight: bold;
text-shadow: 1px 2px 0 rgba(0,0,0,0.3);
}

.price-table .price-details {
padding: 20px 0;
background: #cedee6;
font-size: 4.46em;
line-height: 1.1em;
font-weight: bold;
color: #4b5d72;
margin-bottom: 15px;
text-shadow: 1px 2px 0 rgba(255,255,255,0.6);
}
.price-table .price-details .price-recur {
display: block;
font-size: 0.4em;
line-height: 0.9em;
font-weight: normal;
}

.price-table .details-list {
list-style: none;
text-align: left;
margin-bottom: 10px;
}
.price-table .details-list li {
display: block;
padding: 8px 0;
padding-left: 40px;
font-size: 1.2em;
line-height: 20px;
font-weight: bold;
background-position: 6px 5px;
background-repeat: no-repeat;
border-bottom: 1px solid #a7b7bf;
}

You’ll notice the header uses a CSS3 background gradient with browser prefixes to create the glossy effect. As we move down to .price-details the background turns into a stationary color, and the pricing table itself uses a darker gray for the original background. Each of these sections will appear divided and still come together forming a recognizable pricing table.


On each of the .details-list li elements we need to keep the same background properties, but swap out different images. I figured the simplest way to do this would be including the same background-position and background-repeat values for each list item. Then for individual classes we switch between the icon URL itself.


The Recommended Table


You may have already noticed that the “Pro” table has a lighter purple hue in comparison to the darker teal. Many pricing tables will encapsulate one of the plans to appear more noticeable than the others. Companies offer these plans as the best deal for your money, and hope to persuade visitors into choosing that plan for its greater value.


The recommended table’s header is much shorter in height because I’ve included a small notice to catch people’s attention. You could get fancy using ribbons or badges, however I wanted to avoid extraneous images for this design. The table itself has an additional class so we can target internal elements using .price-table.recommended as the selector.



.price-table.recommended {
background: #6c7b9b;
}

.price-table.recommended header {
padding: 5px 0;
background-color: #5a76b1;
background-image: -webkit-gradient(linear, left top, left bottom, from(#495e8a), to(#5a76b1));
background-image: -webkit-linear-gradient(top, #495e8a, #5a76b1);
background-image: -moz-linear-gradient(top, #495e8a, #5a76b1);
background-image: -ms-linear-gradient(top, #495e8a, #5a76b1);
background-image: -o-linear-gradient(top, #495e8a, #5a76b1);
background-image: linear-gradient(top, #495e8a, #5a76b1);
border-bottom: 1px solid #3b577e;
}
.price-table.recommended .notice {
font-size: 1.2em;
line-height: 20px;
background: #3b577e;
font-weight: bold;
}

.price-table.recommended .price-details {
background: #bac7ea;
padding: 20px 0;
}

To compensate for the loss of space I’ve reduced the header padding from 30px down to 10px. This is also why the small .notice text uses a line-height of 20px. I wanted the last two tables to stay perfectly aligned, even though they do feature slightly different content. Mostly all of the background colors have been updated along with the purchase button.



.price-table.recommended .purchase-btn a {
border-color: #6a3fc2 #7045bf #651fbb;
background: #6149ad;
background-image: -webkit-gradient(linear, left top, left bottom, from(#7a67d8), to(#6149ad));
background-image: -webkit-linear-gradient(top, #7a67d8, #6149ad);
background-image: -moz-linear-gradient(top, #7a67d8, #6149ad);
background-image: -ms-linear-gradient(top, #7a67d8, #6149ad);
background-image: -o-linear-gradient(top, #7a67d8, #6149ad);
background-image: linear-gradient(to bottom, #7a67d8, #6149ad);
}
.price-table.recommended .purchase-btn a:hover {
background: #634fc2;
background-image: -webkit-gradient(linear, left top, left bottom, from(#8876e2), to(#634fc2));
background-image: -webkit-linear-gradient(top, #8876e2, #634fc2);
background-image: -moz-linear-gradient(top, #8876e2, #634fc2);
background-image: -ms-linear-gradient(top, #8876e2, #634fc2);
background-image: -o-linear-gradient(top, #8876e2, #634fc2);
background-image: linear-gradient(to bottom, #8876e2, #634fc2);
}
.price-table.recommended .purchase-btn a:active {
background: #503d88;
background-image: -webkit-gradient(linear, left top, left bottom, from(#6d58bd), to(#503d88));
background-image: -webkit-linear-gradient(top, #6d58bd, #503d88);
background-image: -moz-linear-gradient(top, #6d58bd, #503d88);
background-image: -ms-linear-gradient(top, #6d58bd, #503d88);
background-image: -o-linear-gradient(top, #6d58bd, #503d88);
background-image: linear-gradient(to bottom, #6d58bd, #503d88);
}

custom designed html5 css3 pricing tables tutorial open source


Live Demo Download Source Code


Closing


You won’t find a need for pricing plan tables in every project. Actually you probably won’t need them for a majority of web projects. But there are many companies which offer a recurring service, like TypeKit or MaxCDN. These are the designs which can truly incorporate pricing tables with a sense of purpose. Feel free to use my source code in your own website layouts, and to share any questions or ideas you may have in the post discussion area below.





Advertise here with BSA







Source: http://ift.tt/Kz6qCI

No comments:

Post a Comment

 

The Cash Box Blueprint

Most Reading