Preview
Color :
Font Family :
Font Size :

Hover
Color :
Color :
Bottom Color :

Hover
Color :
Bottom Color :
Color : Style :
Width :
Radius Top :
Radius Right :
Radius Bottom :
Radius Left :
Hover Color :
Top :
Right :
Bottom :
Left :
Horizontal :
Vertical :
Blur :
Color :
Horizontal :
Vertical :
Blur :
Spread :
Color :
Highlight and Copy HTML Code below. Paste it into your HTML page.

Welcome to the Best CSS Button Generator site. In addition to providing tips and techniques related to Cascading Style Sheets, this site will showcase useful methods and code that would be invaluable to any webmaster, developer or designer.

Best CSS Button Generator

You will still find loads of buttons that you may use on your own website for free. Sites offering free buttons are already quite plentiful on the Internet, but what makes CSS buttons special is their speed, simplicity and elegance. We have buttons made entirely out of CSS/HTML that load instantly and you will also find buttons enhanced with CSS.

CSS-based buttons offer numerous advantages:

  1. They are smaller and hence quicker to load
  2. They can be modified much easier than an image can
  3. They are more easily accessible by text-based browsers and web crawlers, giving your site a wider audience and better SEO.
  4. Here are a couple of examples of buttons created or enhanced using plain CSS and HTML. I decided to use inline CSS to make it simpler to use the buttons and cater for different types of buttons on a single page. This does increase the size and you can make the code even smaller by including the CSS in a separate .css file.

CSS Button Generator

The CSS Button generator is generator that generates button styles online. The generated CSS3 buttons code can support cross browsers.This Tool is provide a better and easier interface for beginners learning CSS HTML coding.

How to generate CSS button styles

Button Maker can generate beautiful, custom button CSS. On the left, you can customize the button height, width, background color, font, font color, button shadow, button step color, border, button rounded corners, and more. Generate Code tab, copy the HTML and CSS code of the respective CSS buttons and insert them into your code.

Supported Browsers

Google Chrome, Firefox, Safari, Opera ,Internet Explorer and More...

What is CSS?

< h1 >This is a heading < /h1 >

< p >This is a paragraph. < /p >

When tags like < font >, and color attributes were added to HTML, developers of large web sites had to spend a lot of time changing the fonts and color information in every single page.

To solve this type of problem, the World Wide Web Consortium (W3C) created CSS.

CSS Syntax

H1 {color: red; text-align: center}

Here we are redefining the H1 tag to have all the properties that an H1 tag would have (larger than normal text and bolded) but also the text will be red and centered. (Cascading Style Sheets means that the original rule of the HTML tag will be kept unless it is overridden by the CSS declaration. In this case there is no conflict, so the color and text align rule will cascade over the regular HTML H1 tag specifications).

H1
{
color: red;
text-align: center;
}

The CSS ID Selector

The id selector is accustomed to specify a style for a single, new element. The id selector utilises the id attribute of the HTML element and is defined with a "#". The style rule down will be used for the element with id="page1headline":

Code View

Browser View

< html >
< head >
< style type="text/css" >
#page1headline
{
text-align:center;
color:red;
font-size: 25px;
}
< /style >
< /head >

< body >
< p id="page1headline" >Red Headline < /p >
< p >This paragraph is not affected by the id selector. < /p >
< /body >
< /html >

Red Headline

This paragraph is not affected by the id selector.


CSS Class Selectors

CSS Class Selectors The class selector is used for specifying a style for a grouping of elements.. The class selector uses the HTML class attribute, and is defined with a "." You can make up whatever word you like, but it usually something that would describe the style. For example:

.center {text-align:center; color: blue}

.centerblue is the name we made up for the class selector.

In the example below, all HTML elements with class="center" will be center-aligned:

Code view

Browser View

< html >
< head >
< style type="text/css" >
.centerblue
{
text-align:center;
color: blue;
}
< /style >
< /head >

< body >
< h1 class="centerblue" >Center-aligned blue heading < /h1 >
< p class="centerblue" >Center-aligned blue paragraph < /p >
< /body >
< /html >

Center-aligned blue heading

Center-aligned blue paragraph

Applying Stylesheets to HTML Pages

There are three ways of applying CSS style to your HTML pages.

An External style sheet Internal style sheet Inline style An outer style sheet often used when the style is applied to multiple pages within a site. It allows you to have a consistent look and feel within a site and gives you the power to change that look by modifying just one file! Imagine you wanted all of the H1's on your site to be the color blue and centered, but then you change your mind and want them all to red. Instead of changing the style page by page, you can just update the .CSS file. Each page must link to the style sheet using the < link > tag which is embedded in the head of the html document. In this example, the HTML page is linking to an external file, mystyles.css:

< head >
< link rel="stylesheet" type="text/css" href="mystyles.css" / >
< /head >

Here is an example of what an external style sheet file, mystyles.css, would look like. Note that there are no HTML tags - just style specifications. This code can be written in any text editor and saved with a .css extention.

external_stylesheet_example.htm mystyles.css

< html >
< head >
< title >Untitled Document < /title >
< link rel="stylesheet" type="text/css" href="mystyles.css" / >
< /head >

< body >
< h1 >This text is a Header 1. < /h1 >
< p >This text is in a paragraph. < /p >
< /body >
< /html >

H1 {color:blue; text-align:center}
P {font-family:arial, helvetica, sans-serif; font-size: 10pt}
body {background-color:yellow}

View the HTML page (external_stylesheet_example.htm) that references mystyles.css.

Internal Style Sheets

an internal style sheet must be used when a single document has a new or unique style. Style specified in an internal style sheet will override the style of a linked stylesheet (.css file) if there is a conflict. You define internal styles in the head section of an HTML page, by using the < style > tag, like this:

< head >

< style type="text/css" >
H1 {color:red; text-align:center}
TD {font-weight: bold}
P {font-family: arial, helvetica, sans-serif; font-size: 10pt}
body {background-color: white}
< /style >

< /head >

Inline Styles

An inline style is a style specification that goes directly in the HTML tag. The closer the style is to the text the more importance it has. Therefore, inline style will override and internal style sheet or a linked style sheet if there is any conflict. In this example we are adding style to one particular Paragraph tag in an HTML document.

< p style="color:blue; font-size: 20px" >This is a paragraph. < /p >

Cascading order

What style will be used when there is better than one style defined for an HTML element? All the styles will "cascade" down with inline style having the highest priority:

Note: If the link to the external style sheet is placed after the internal style sheet in the < head > < /head >, the external style sheet specifications will override the internal style sheet because it is closer to the body of the HTML document!

CSS Backgrounds

In this section we will explore how to use CSS to specify background color, image, repeating image, and attachment.

background-color

background-image

HTML document CSS document - mystyles.css

< html >
< head >

< link rel="stylesheet" type="text/css" href="mystyles.css" / >

< title >Background repeat image < /title >
< /head >

< body >
< h1 >The leaf image will repeat down and across for as long as the page goes by default < /h1 >
< /body >
< /html >

body
{
background-image:url('images/leaf_background.jpg');
}

When incorporating a background into your page, you might want to make sure it is not too dark or busy that it makes your text difficult to read. The leaf example above would probably not be a great background. Try this instead.

background-repeat

by default, the background image will repeat. If you would like to have just one instance of the image appear in the top right hand corner (no tiling) use:

body {background-image:url('leaf_background.gif'); background-repeat: no-repeat;}

If you would like your background image to repeat, but only across the top of your page you can use background-repeat: repeat-x or if you'd like to tile your image down the left hand side of the page use background-repeat: repeat-y.

Body {background-image:url('leaf_background.gif'); background-repeat: repeat-y}

background-attachment

This says whether a background image is fixed or scrolls with the rest of the page. By default, the image will scroll with the rest of the page, but you can use this code to have the image stay fixed in the top left hand corner of the screen.

Body {background-image:url('leaf_background.gif'); background-attachment: fixed}

Text Formatting with CSS

Color

Remember that the style rule closest to the text will override any style rule conflicts. If you specify "body {color:blue}" but you want a certain paragraph to be red, the text color set in the paragraph tag "P {color: red}" would override the text color that was set in the body tag.

HTML document CSS document - mystyles2.css
< html >
< head >

< link rel="stylesheet" type="text/css" href="mystyles2.css" / >

< title >CSS text color example < /title >
< /head >

< body >
< h1 >The text is blue here as specified for the entire body of the document < /h1 >

< p >blah blah blah yadda yadda yadda blah blah blah yadda yadda yadda blah blah blah yadda yadda. < /p >

< p style="color: red" >blah blah blah yadda yadda yadda blah blah blah yadda yadda yadda blah blah blah yadda yadda yadda. < /p >

< p >blah blah blah yadda yadda yadda blah blah blah yadda yadda yadda blah blah blah yadda yadda yadda. < /p >

< /body >
< /html >
body {color: blue}

Text Alignment

text-align is used to set the horizontal alignment of text whether it be center, right, left, or justified (when you have a block of text where the right and left margins are lined up like in a magazine or newspaper). Here is an example using an HTML tag and a class selector:

h1 {text-align:center;}
.locations {text-align:right;}
.maintext {text-align:justify;}

Text Decoration

text-decoration is mostly used to remove underlines from links for design purposes. Sometimes a page with a lot of links can look messy or crowded, so it may be a nice design touch to remove the default underline from your the links on your page using

a {text-decoration:none;}

Consider the code:

< html >
< head >
< title >Untitled Document < /title >
< style type="text/css" >
a {color: #F30; text-decoration: none}
< /style >
< /head >

< body >
< h2 >The text "Accelebrate" is a hyperlink with the underline taken off < /h2 >
< p >  < /p >
< p > < a href="#g" >Accelebrate < /a > provides ASP.NET training and Java training classes, as well as course on Flash ColdFusion XML Dreamweaver Authorware and other technologies < /p >
< /a >

< /body >
< /html >

The "a" refers to the anchor tag with the href property such as < a href="#" >. We made the color of link an orange color and text-decoration: none simply means to remove the underline.

Other values for the text-decoration property are overline, underline (for text that is not a link but you want it underlined anyway. This probably not a great idea on the web, though, since most people will want to click things that are underlined!), overline, and blink (which is just what it sounds like - blinking text- which could be quite annoying).

Letter Spacing and Word Spacing

letter-spacing defines extra space between characters and word-spacing defines extra space between words. Negative values are allowed for both if you want to bring the letters or words closer together rather than spreading them further apart.

To add 5 pixels of extra space between characters use h1 {letter-spacing:5px}

To make the words appear to smush together use h1 {word-spacing: -3px}

Consider the code:

< html >
< head >
< meta http-equiv="Content-Type" content="text/html; charset=utf-8" / >
< title >CSS example: letter spacing and word spacing < /title >
< style type="text/css" >

.title1 {letter-spacing: 20px;}

.title2{ letter-spacing: -2px;}

.title3{word-spacing: 30px;}

< /style >
< /head >

< body >
< h2 class="title1" >This is an example of letter spacing < /h2 >
< h2 class="title2" >This is another example of letter spacing < /h2 >
< h2 class="title3" >This is an example of word spacing < /h2 >
< /body >
< /html >


Font Formatting

Use the font-family property to set the font for a page or any element within a page. You should list three fonts so that if the browser does not support the first font, it tries the next font. Font families are fonts that are similar such as arial, verdana, sans-serif. If the title of a font family is more than one word, it should be in quote marks, like font-family: "Times New Roman". An example of setting a font family for text in all table data cells would be:

td {font-family:"Times New Roman", Times, serif;}

Font Style

The font-style property has three values: normal, italic and oblique (with oblique the text is "leaning" and very similar to italic, but less supported). To set the text of all Header 2 tags, for example, to italics use:

h2 {font-style: italic;}

Font Size

The font-size property lets you set the size of the font in px (default size is 16px), em (default size is 1em since 16px is equal to 1em), %, or words such as small, medium, and large. Here is an example using pixel size to set the font-size:

h1 {font-size:50px;}
h2 {font-size:40px;}
p {font-size:20px;}

Link Formatting with CSS

You may want to take the underline off of your links and only have that underline show when a user hovers over the link or you may want to change the default color of a link, visited link or the color of the link as a user is hovering over it.

Links can be styled just as any other html tag can be styled - with color, font-family, background-color, size, etc. There are four links states are that we can apply styles to. They are:

a:link - a normal, unvisited link
a:link {text-decoration:none;} (this takes off the underline)

a:visited - a link the user has visited
a:visited {text-decoration:none; color: red} (this takes off the underline and makes the linked text red)

a: hover - a link when the user mouse over it
a:hover {text-decoration:underline; color: black} (this causes the underline to appear and makes the text color turn to black)

a: active - a link the point is clicked
a:active {text-decoration:underline;}

HTML document CSS document - linkstyles.css

< html >
< head >
< title >CSS example a:link a:visted a:hover a:active < /title >

< link rel="stylesheet" type="text/css" href="linkstyles.css" / >
< /head >

< body >
< p > < a href="#" >Accelebrate < /a > delivers ASP.NET training and Java training classes, as well as courses on Flash ColdFusion XML Dreamweaver Authorware and other technologies < /a > < /p >

< /body >
< /html >

a:link {text-decoration:none; color: red}
a:visited {text-decoration:none; color: red}
a:hover {text-decoration:underline; color: black}
a:active {text-decoration:underline; color: black}

List Formattingwith CSS

Using the property list-style-type, you can go beyond the HTML unordered list and ordered list constraints. Using the following CSS code you can stylize both types of lists:

HTML document CSS document - liststyles.css

< html >
< head >

< link rel="stylesheet" type="text/css" href="liststyles.css" / >

< title >list example < /title >
< /head >

< body >
< h3 >Example of unordered lists: < /h3 >
< p > < strong >Cooffe: < /strong > < /p >

< ul class="Cooffes" >
< li >Sumatra < /li >
< li >French Roast < /li >
< li >Kenyan < /li >
< /ul >
< p > < strong >Tea: < /strong > < /p >

< ul class="teas" >
< li >English Breakfast < /li >
< li >Green < /li >
< li >Herbal < /li >
< /ul >

< h3 >Example of ordered lists: < /h3 >
< p > < strong >Soft drinks: < /strong > < /p >

< ol class="softdrinks" >
< li >Coke < /li >
< li >Sprite < /li >
< li >Root Beer < /li >
< /ol >
< p > < strong >Juices: < /strong > < /p >

< ol class="juices" >
< li >Apple < /li >
< li >Orange < /li >
< li >Guava < /li >
< /ol >

< /body >
< /html >

ul.Cooffes {list-style-type: circle;}
ul.teas {list-style-type: square;}

ol.softdrinks {list-style-type: upper-roman;}
ol.juices {list-style-type: lower-alpha;}

You can also use an image in the place of a bullet. Just use the following code and put in the path to your own image:

ul
{
list-style-image: url('orangebullet.gif');
}

Table Formatting with CSS

You can achieve really great looking tables with CSS. Style associated with the table tag include

Fruit (100 grams) calories Water Fiber in grams
Kiwi 40 84% 2.1
papaya 32 91% 0.6
Pomegranite 81 81% 3.4
Orange 70 87% 2.0

Fruit (100 grams) calories Water Fiber in grams
Kiwi 40 84% 2.1
papaya 32 91% 0.6
Pomegranite 81 81% 3.4
Orange 70 87% 2.0

A few simple snippets of reusable CSS code can serve as a more attractive table style for your site. Here are the style rules associated with the table above:

.tableheader {color: white; background-color:#066; font-size: 18px; font-weight:bold;}
.td1 {background-color: #FF9}
.tablestyle {vertical-align: center; text-align: center; border: 2px solid black;}

In the HTML table, each class selector is then referenced:

< table width="800" border="1" class="tablestyle" >
< tr class="tableheader" >
< td width="181" >Fruits (200 grams) < /td >
< td width="173" >calories < /td >
< td width="207" >Water < /td >
< td width="211" >Fibers in grams < /td >
< /tr >
< tr >
< td >Kiwi < /td >
< td >40 < /td >
< td >84% < /td >
< td >2.1 < /td >
< /tr >
< tr class="td1" >
< td height="20" >papaya < /td >
< td >32 < /td >
< td >91% < /td >
< td >0.6 < /td >
< /tr >
< tr >
< td height="20" >Pomegranite < /td >
< td >CSS Button Generator81  < /td >
< td >81% < /td >
< td >3.4 < /td >
< /tr >
< tr class="td1" >
< td height="20" >Orange < /td >
< td >70 < /td >
< td >87% < /td >
< td >2.0 < /td >
< /tr >
< /table >

CSS Property References

For a list of CSS property-value pairs for tables and all other HTML elements, please see The W3Shools CSS Reference Guide or HTML Dog CSS Properties.