CSS3 Expanding Icons

Written by akshay. Posted in Tutorial

CSS3 expand icons Welcome to yet another CSS3 tutorial by Coder’s Cabin, once again I present a tutorial about how to use CSS3 transitions!

Overview


We will be making a social networking icon, it uses just one single image. All the backgrounds and animation effects are generated by CSS3.

Preparation


As we start, we need to know what we are working on. Lets start by making a twitter icon on photoshop. I have the font, so I have made an icon using this in my photoshop (transparent icons are included in the download file). This time, instead of starting with the HTML, let’s start with the CSS!
.icon{
	width:0px;
	height:22px;
	overflow:hidden;
	border:1px solid #000;
	-moz-border-radius:5px;
	white-space:nowrap;
	webkit-transition: all 0.2s ease-in-out;
	-moz-transition: all 0.2s ease-in-out;
	-o-transition: all 0.2s ease-in-out;
	-ms-transition: all 0.2s ease-in-out;
	transition: all 0.2s ease-in-out;
}

.icon:hover {
	width:150px;
	webkit-transition: all 0.2s ease-in-out;
	-moz-transition: all 0.2s ease-in-out;
	-o-transition: all 0.2s ease-in-out;
	-ms-transition: all 0.2s ease-in-out;
	transition: all 0.2s ease-in-out;
}

I have made a class icon. This is the class which holds all the properties for our expanding icon. When on normal state, we have set the width of the icon as 0px. This is set as 0 since we will define it separately in other classes. In psuedo-class .icon:hover, the width has been set to 150px, this is the maximum size the icon can be widened to. If you wish you can increase or decrease it as per your needs. One more thing that you might have noticed is that, I have included transition effects (webkit-transition, -moz-transition, -o-transition, -ms-transition, transition) in both .icon class and in .icon:hover psuedo-class. This is done because whn some one hovers over the icon class, it must expand with an animation and also when some one hovers out of the icon class it must retract to its original form with a reverse animation.
TIP : Smooth transitions with easing do look good, but they are not meant to be used everywhere. Avoid using too many transition effects in a website.

Making an icon


So, now we have to write up the HTML for our icons.
<a href="#">
</a></pre>
<div id="twitter" class="icon">Follow on Twitter</div>
<a href="#">
</a>
We have simply added the HTML tags in the order of : Anchor Tag (perform action on click) >> Division Tag (Provide styling of the icon) >> Span Tag (Text for the icon) Since we are making the twitter icon, I have included the icon class and twitter id.

#twitter{
background: #def8f9; /* Old browsers */
background:url(images/twitx32.png) no-repeat, -moz-linear-gradient(top, #def8f9 2%, #9de2e7 2%, #82d0d6 50%, #76c4c8 50%); /* FF3.6+ */
background:url(images/twitx32.png) no-repeat, -webkit-gradient(linear, left top, left bottom, color-stop(2%,#def8f9), color-stop(2%,#9de2e7), color-stop(50%,#82d0d6), color-stop(50%,#76c4c8)); /* Chrome,Safari4+ */
background:url(images/twitx32.png) no-repeat, -webkit-linear-gradient(top, #def8f9 2%,#9de2e7 2%,#82d0d6 50%,#76c4c8 50%); /* Chrome10+,Safari5.1+ */
background:url(images/twitx32.png) no-repeat, -o-linear-gradient(top, #def8f9 2%,#9de2e7 2%,#82d0d6 50%,#76c4c8 50%); /* Opera11.10+ */
background:url(images/twitx32.png) no-repeat, -ms-linear-gradient(top, #def8f9 2%,#9de2e7 2%,#82d0d6 50%,#76c4c8 50%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#def8f9', endColorstr='#76c4c8',GradientType=0 ); /* IE6-9 */
background:url(images/twitx32.png) no-repeat, linear-gradient(top, #def8f9 2%,#9de2e7 2%,#82d0d6 50%,#76c4c8 50%); /* W3C */

padding:8px 0 2px 32px;

border:1px solid #4a959b;

-webkit-box-shadow: 0px 3px 0px 0px #146f6a;
-moz-box-shadow: 0px 3px 0px 0px #146f6a;
box-shadow: 0px 3px 0px 0px #146f6a;

color:#135954;
text-shadow: 1px 1px 0px #c0dbd9;
filter: dropshadow(color=#c0dbd9, offx=1, offy=1);

}

#twitter:hover{
	width:130px;
}

#twitter:active
{
	margin-top:4px;
	margin-bottom:0px;
	-moz-box-shadow:none;
	-webkit-box-shadow:none;
	box-shadow:none;
}

In div #twitter we have set the default background (for old browsers) and specific background for each latest browser (check comments). Finally adding border with curves! As we write the hover state of the #twitter:hover we increased the width of twitter division to 130px. While, the twitter button is pressed :active pseudo-class is fired. In this we have increased the margin-top property to 4px, so that a push down effect can be seen. Also, we have included text-shadow for each different button. This text-shadow property helps in giving a letter pressed effect to the button. So far, we have made the layout of a button, which expands on hover and gives a clean push down effect.

Final Steps



span{
	margin-left:10px;
	font-family:"Myriad Pro";
	font-size:13px;
	font-weight:bold;
}

a{
	margin:10px 5px 0;
	float:left;
	text-decoration:none;
	display:block;
}
We have used Anchor tag and Span tag for setting up hyperlink and to display text on the button. We just had to style them according to our usage.
View Demo Download Files

Free banner template

Written by akshay. Posted in freebie

banenr_post Well here comes another freebie from Coder’s Cabin! Today, I am giving away web banner template (468 x 60), available in 3 colors. These are very basic type of banners for small scale websites. If you want more advanced and attractive banners contact me! This files are available for commercial use

CSS3 / jQuery Notification boxes

Written by akshay. Posted in Tutorial

notification Yesterday, I was making something for a client. It required two notification boxes, forĀ  acceptance and rejection. So I thought why not share a professional notification boxes tutorial with you guys! Initial planning The first and the foremost thing you need to make an attractive notification box are the colors and the icons used. In basic terms, Yellowish-Green = Success Light Red = Error Pale yellow = Alert Sky Blue = Other Information
TIP : Always use light & plain colors for the background of your notification box.
Step 1 : HTML Lets start by placing simple HTML content to our webpage
</pre>
<div class="green">Success!
 Lorem ipsum dolor sit amet, consectetur.
<div class="cross">x</div>
</div>
<pre>
This is the basic structure of a notification box, without THE CSS or javasript. Here, I have used the class green, to set the background of the notification as greenish type. Another class, cross, is also used here. It is meant for closing a notification box (Will discuss about this when jQuery section comes up) Step 2 : CSS
span{
color:#444;
margin-right:10px;
}

.green{
background:#e8f1c4 url(images/success.png) no-repeat left;
background:url(images/success.png) no-repeat left, -moz-linear-gradient(top, #eff7dc 5%, #e4efb6 6%, #e8f1c4 21%, #eaf7ca 50%, #e8f1c4 93%, #d6e0b8 100%); /* FF3.6+ */
background:url(images/success.png) no-repeat left, -webkit-gradient(linear, left top, left bottom, color-stop(5%,#eff7dc), color-stop(6%,#e4efb6), color-stop(21%,#e8f1c4), color-stop(50%,#eaf7ca), color-stop(93%,#e8f1c4), color-stop(100%,#d6e0b8)); /* Chrome,Safari4+ */
background:url(images/success.png) no-repeat left, -webkit-linear-gradient(top, #eff7dc 5%,#e4efb6 6%,#e8f1c4 21%,#eaf7ca 50%,#e8f1c4 93%,#d6e0b8 100%); /* Chrome10+,Safari5.1+ */
background:url(images/success.png) no-repeat left, -o-linear-gradient(top, #eff7dc 5%,#e4efb6 6%,#e8f1c4 21%,#eaf7ca 50%,#e8f1c4 93%,#d6e0b8 100%); /* Opera11.10+ */
background:url(images/success.png) no-repeat left, -ms-linear-gradient(top, #eff7dc 5%,#e4efb6 6%,#e8f1c4 21%,#eaf7ca 50%,#e8f1c4 93%,#d6e0b8 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eff7dc', endColorstr='#d6e0b8',GradientType=0 ); /* IE6-9 */
background:url(images/success.png) no-repeat left, linear-gradient(top, #eff7dc 5%,#e4efb6 6%,#e8f1c4 21%,#eaf7ca 50%,#e8f1c4 93%,#d6e0b8 100%); /* W3C */
border:1px solid #cad883;
padding:10px 0px 10px 30px;
margin:10px 0;
color:#4e871c;
font-weight:700;
font-family:Verdana, Geneva, sans-serif;
font-size:11px;
width:400px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
}

.cross{
float:right;
margin:5px 5px 0 0;
font-size:12px;
line-height:10px;
font-variant:small-caps;
font-weight:bolder;
cursor:pointer;

}

.cross:hover{
color:#000;
}
This is the backbone of our notification boxes, CSS3 is powerful enough to provide gradients, curved border edges, shadows. These are the prime ingredients of any eye-candy notice box! Lets understand the code, We will start by class green. We have included CSS3 gradient along with a background image. This way we have reduced the unnecessary use of additional img or div tags.
TIP : A background image can also be used with a CSS3 gradient in “background” property by adding “url([IMAGE BACKGROUND]) ,[GRADIENT];”
Another important thing to be noticed is that, I have used multiple gradients instead of a simple two colors fade. This can be easily understood in the above code. Ok, so we have styled out container for the notification, but we must also give some button to close it! Otherwise it will look really stupid to have a success and an error notification for a same object. For this I have used an “X” button (ASCII 088) for the close option. You can close the notification box automatically or u can ask the user to close it. I am making the latter. I have used cross class to stylize the “X”. Up-till now we have made a static notification box. Step 3 : jQuery As stated earlier, we are only using javascript to hide the notification boxes. This effect can also be done using CSS3 transitions. First you have to include jQuery to you file.
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
It is very important to specify this code, else our jQuery functions will not work. I have specially mentioned this because newbies like me often tend to forget these lines and after hours of headbanging with my JS function I find out this ugly and humiliating error! Anyways, let’s get back to our notification box.
$(document).ready(function(){
	$(".cross").click(function(){
	$(this).parent("div").fadeOut('slow');
	})
});
A simple function, where when we click on cross the notification box closes. This is how it works. When a user clicks on “.cross” class, the control moves to the inner function. I have used “this” function so that we can only close the parent division (which is the “green” in this case). Step 4 : Sum up Similarly, we can make all other notification boxes for other colors to!
View Demo Download Files

15 inspirational portfolio websites

Written by akshay. Posted in Inspirations

inspi We all plan to make our very own portfolio websites. A website which can feature our PROs and cons, display our past work / portfolio, make new contacts etc etc. But sometimes we just run out of unique ideas! I am also in the process of making my portfolio website! So, for the past few weeks I have been crawling all around the web to get something which I can add to my idea and make it even bigger! I have shortlisted 15 websites which I just adore! If you have some more you can add em up in the comments. 1 minus 1 beaverlab carsonified markhobbs chriswi foreverheavy chrisjockey zachstubenvoll artsource hagenburger joedowdle elladesign rzdesign projectaquarius zoltanhosszu If you wish to share more.. please add em bellow!!

Two Payment Processor Icons

Written by akshay. Posted in freebie

freebie Hey! Just sharing two payment processor icons.
  • PaPal
  • AlertPay
You are free to use these icons anywhere, but a link-back will be highly appreciated.
Download Files

Designing a registration page eh?

Written by akshay. Posted in Tips & Tricks

regis_tip What comes to our mind when we see some awesome informational websites, blog or a forum? Well, personally speaking I would register on the site to get full access to the content which I feel is useful. Over the years I have come across thousand of such websites, but of those thousands I have only registered on a few hundred such website. So why didn’t I got registered on all those websites? Well primarily the content and activity has a major role to play when it comes to registration. Secondly, sometimes the registration pages are so messed up that the feeling to connect with the sites just vanishes! If we look at this from a webmasters perspective, it’s a big loss, since a prospective customer may be lost due to unhealthy registration page. A few months back I came across this site, the registration page was not messed up but the colors were an eye-sore! The background of the site was bright yellow and the input boxes and the text was of red color. A total FAIL. Instead of a register page it was looking like someone spilled tomato ketchup on mustard sauce (puke ….. )! Enough said about the messed up registration pages, lets see what it takes to make an appealing and a simple to understand login page. The simplest registration form to understand is the most minimalistic one. Lets take an example from www.squarespace.com registration page . The registration page is very well designed. Just in four input boxes the user is ready to take a dip in the site! What makes it more appealing is that all the input boxes are in one single line, the user does not need to scroll down to see all the requirements. Color combination of this registration page makes it a “plus” for the user. Any user can easily understand the that once I am done with providing my details, I have to click on the big green button. The finish button is colored green which is in total contrast to the background of the website, making it more prominent in the form. This is a very simple registration page, but what about those big multiple page registrations? For this section I would like to give you an insight using the example from Envato marketplace registration. This is a very big network so the registration page is also equally big. But due to its amazing design it looks very clean and neat. For our reference I have marked a few items which have an effect on this registration page. 1 – Since the registration takes three steps to complete, a list of steps is placed on the top of the registration page. Now since there is a list of predefined steps, it is very unlikely that a user will not complete his registration process. This would apparently decrease the number of failed registrations and increase in completed registration. One more thing that has to be noted is that, the active step is colored in dark grey and the next steps or non-active steps and in light gray. This is very useful for a user since he know how many steps are left, I am on which step etc. 2 – Here comes the main registration section. The input box are of large sizes which makes it easy for typing and readability. The space and architecture of this section is such that any field cannot be left blank. There is ample space between the fields which makes it difficult to skip any of the field. 3 – This is just a general overview and advantages of the marketplace. According to me it is just to fill in the space which is left on the side of the main registration segment. But apparently this also has an impact on the registration. This part includes all the major point about the website, so even if the visitor misses any point he can read it here, before registration. Moving to the lower section of the site we have two major things to discus. 4 – Captcha is a very powerful tool to stop spam or fake registrations. A must for any website. As they say one real user is much better than having 100 fake users on your site. 5 – Final step of an aesthetic registration form is having a prominent call or action button. As you can see here Envato has a big dull magenta button. Which is again in contrast with the background of the site. A big action button performs as the final step of a registration page. Hope this little tip helped you in redesigning or adding new things on your registration page!

Two level menu using CSS3 transitions

Written by akshay. Posted in Tutorial

css3menu We will create a two level menu using CSS3 and will include effects which were earlier only possible with javascript! Step 1 Lets start by making a simple list in HTML.
<div id="cc-menu">
    <ul>
        <li><a href="#">HOME</a></li>
        <li><a href="#">ITEM 1</a></li>
        <li><a href="#">ITEM 2</a></li>
        <li><a href="#">CONTACT</a></li>
    </ul>
    <div class="clear"></div>
</div>
I have wrapped the UL tags in a DIV tag having an ID of cc-menu, we will be soon adding styles to the cc-menu. Step 2 We will now add the basic styles for the unordered list to make it a menu.
#cc-menu ul li{
	display:inline;
	float:left;
	list-style:none;
	position:relative;
	margin: 0 5px;
}

#cc-menu li a{
	color:#000;
	text-decoration:none;
	font-family:Verdana, Geneva, sans-serif;
	font-size:12px;
	padding:10px;
	background: #f2f6f8;
	background: -moz-linear-gradient(top, #f2f6f8 0%, #d8e1e7 50%, #b5c6d0 51%, #e0eff9 100%);
	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f2f6f8), color-stop(50%,#d8e1e7), color-stop(51%,#b5c6d0), color-stop(100%,#e0eff9));
	background: -webkit-linear-gradient(top, #f2f6f8 0%,#d8e1e7 50%,#b5c6d0 51%,#e0eff9 100%);
	background: -o-linear-gradient(top, #f2f6f8 0%,#d8e1e7 50%,#b5c6d0 51%,#e0eff9 100%);
	background: -ms-linear-gradient(top, #f2f6f8 0%,#d8e1e7 50%,#b5c6d0 51%,#e0eff9 100%);
	background: linear-gradient(top, #f2f6f8 0%,#d8e1e7 50%,#b5c6d0 51%,#e0eff9 100%);
	border:1px solid #A8B7BF;
	border-radius:5px;
	-moz-border-radius:5px;
	-webkit-border-radius:5px;
}
Ok, so as we have included the basic CSS and CSS3, lets break the above code. We have used #cc-menu ul li to get to the li tag inside ul which is located in the #cc-menu id. Next we have to style the anchor tag (a) inside li, this is also basic styling until CSS3 comes into play! We have made a CSS3 gradient code and changed a border radius. To easily generate CSS3 gradients visit colorzilla Step 3 Since we will make a two-level drop down menu we will have to include another list inside a list-item (li).
<li><a href="#">ITEM 1</a>
    <ul>
        <li><a href="#">sub item 1</a></li>
        <li><a href="#">sub item 2</a></li>
        <li><a href="#">sub item 3</a></li>
    </ul>
</li>
<li><a href="#">ITEM 2</a>
    <ul>
        <li><a href="#">sub item 1</a></li>
        <li><a href="#">sub item 2</a></li>
        <li><a href="#">sub item 3</a></li>
    </ul>
</li>
Step 4 Now we will be styling the list inside the list (sounds weird but CSS is powerful enough to handle this!) To style the list inside the list-item we will use the below code, more over since we only want to display the list on mouse over, we will initially hide it. We wont be using display:none; because it is not possible to use CSS3 transition effects on this, so we will set opacity: 0; and height:0; To implement transition effects we will use -[browser]-transition. Here, all means that any change that can take place on an action. 0.5s means the time in which the transition will complete. ease-in means how the easing effect of transition will take place. To style list-items inside a list-item we use li li.
#cc-menu li ul{
	margin:0px;
	padding:0px;
	display: block;
	height: 0;
	width:200px;
	overflow: hidden;
	opacity: 0;
	position:absolute;
	-webkit-transition: all 0.5s ease-in;
	-moz-transition: all 0.5s ease-in;
	-o-transition: all 0.5s ease-in;
}

#cc-menu li li
{
	padding:10px 0;
	list-style:none;
	display:list-item;
	margin:0px;
	float:none;
}

#cc-menu li li a{
	margin:0px;
}

Step 5 As per final part we will use the :hover pseudo class In the hover state we will set the opacity to 1 and height to auto.
#cc-menu li:hover ul
{	height:auto;
	opacity:1;
	margin:10px 0;
	display:block;
	width:200px;
}
View Demo Download Files

We are going Live!

Written by akshay. Posted in Random

live Dear readers! After months of thinking and research on web technologies we are starting a web log which will be primarily focused on front end and back end coding tutorials, inspirations, tips and tricks. Also occasional posts about graphic designing by us or by some featured authors! From the coder’s cabin team a warm welcome to all readers! regards, Akshay