Essex web design klever media

Read about my daily goings on in the web design industry

this includes web design tips & tricks, and my current work.

Make your own pure css3 buttons

Make your own pure css3 buttons Make your own pure css3 buttons // Essex web design

Make your own pure css3 buttons

26 February 2011 // Posted by Lee Grant

Css3 makes it quick and simple to apply various new styles to your css stylesheet to achieve great effects. Css3 isn't fully supported by all browsers so most designer tend to use the new css rules if they can degrade nicely in browsers such as Internet explorer. For this tutorial we'll be using the new rules, css gradient, css text-shadow & css rounded corners.

All you need to do is create yourself an anchor link with the class "button". Next you need to apply the following css rules to your stylesheet for the desired effect.

a.button {
	margin:10px 0;
	display:block;
	padding:15px 25px;
	width:75px;
	text-align:center;
	color:#fff;
	font-family:Arial, Helvetica, sans-serif;
	text-decoration:none;
	font-size:12px;
	/* styling for chrome */
	background-image: -webkit-gradient(
    linear,
    left bottom,
    left top,
    color-stop(0.25, rgb(183,241,71)),
    color-stop(0.63, rgb(220,255,100))
	);
	/* styling for firefox */
	background-image: -moz-linear-gradient(
    center bottom,
    rgb(183,241,71) 25%,
    rgb(220,255,100) 63%
 
	);
	border-radius:5px;
	-webkit-border-radius:5px;
	-moz-border-radius:5px;
	text-shadow:1px 1px 0 #91c232;
}

We can now add a hover effect to our button, I've just reversed the gradient and removed the test shadow but you can try adding a new gradient colour, or a box shadow maybe.

a.button:hover {
	text-shadow:none;
	background-image: -webkit-gradient(
    linear,
    left bottom,
    left top,
    color-stop(0.25, rgb(220,255,100)),
    color-stop(0.63, rgb(183,241,71))
	);
	/* styling for firefox */
	background-image: -moz-linear-gradient(
    center bottom,
    rgb(220,255,100) 25%,
    rgb(183,241,71) 63%
	);
}

3 comments

Comment quotes

Posted by Selena 6 months ago

I agree this is a really nice tutorial. You helped me to fix my problem.

Comment quotes
Comment quotes

Posted by James Co 1 year ago

I didn't know you could create buttons like this with just css, ie doesn't render css3 so well :(

Comment quotes
Comment quotes

Posted by ProLong 1 year ago

Very useful tutorial on creating css3 buttons, thank you.

Comment quotes

RSS feed for comments on this page | RSS feed for all comments

Post your comment

Essex web designer

Lee Grant

Web designer & developer
Essex, UK

My name's Lee, I'm 23 years young and a full time web designer/developer living and working in the Essex (England) area.

As you might have guessed I have an interest in the web and how it works. On my blog you'll find things like my latest work, design & coding tips and hints as well as tutorials and freebies. To keep up to date with my work you can follow me on some social design websites below or subscribe to my rss feed.

Close profile window