CSS3 Metro Buttons helps you easily re-create those stylish buttons used by Microsoft on their websites.
A light-weight and easy-to-use CSS/JS library that uses CSS3 styles for rich button design.
Created from a personal itch to form a simple CSS/JS library inspired from Microsoft's Modern Design principles.
Free to use for any projects you have in mind, although it would be nice if you gave credit.
Cross-browser compatibile from IE8, to the latest version of Chrome, and Firefox so you don't have to spend countless minutes on testing.
Carefully made to work with the Twitter Bootstrap CSS/HTML framework versions 2.0 and above.
The icons that you can use for the buttons are also taken from the glyphicons image sprite used by Twitter Bootstrap. Twitter Bootstrap has a great array of documents for the complete list of icons in the glyphicon sprite, their respective CSS class names and how to use those icon classes.
I've also provided those "Swap Arrows" in one sprite. These are the arrows extensively being used by Microsoft. Thanks to Syncfusion and their awesome Metro Studio.
Note: if the icons does not seem to appear, double check the filepath in the css files. The default folder path for the
icons is ../img/
Class | Icon |
---|---|
.m-icon-swapright |
|
.m-icon-swapleft |
|
.m-icon-swapup |
|
.m-icon-swapdown |
|
.m-icon-big-swapright |
|
.m-icon-big-swapleft |
|
.m-icon-big-swapup |
|
.m-icon-big-swapdown |
You can also use the white counter-parts of the icons above by adding the m-icon-white
class.
To create a metro-styled text box, just add class="m-wrap"
to
any <input>
, <select>
, or
<textarea>
html element. Viola! You now have a basic modern-styled element.
<textarea class="m-wrap" placeholder="Styled"></textarea>
<input type="text" class="m-wrap" placeholder="Styled" />
<select class="m-wrap">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
<option>Option 4</option>
<option>Option 5</option>
</select>
<br/>
<select multiple="multiple" class="m-wrap">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
<option>Option 4</option>
<option>Option 5</option>
</select>
<input type="file" class="m-wrap">
To depict disabled elements, it needs to look like it's unusable.
Add the disabled
attribute in the element to make it look like its disabled. Place the readonly
to make it uneditable. Lastly, use the m-uneditable-input
with a span
element
if you prefer declaring the readonly style inside the class attribute of an element.
<textarea class="m-wrap" placeholder="Disabled" disabled></textarea>
<input type="text" class="m-wrap" disabled placeholder="Disabled"/>
<br/>
<textarea class="m-wrap" placeholder="" readonly>Readonly</textarea>
<input type="text" class="m-wrap" readonly placeholder="" value="Readonly"/>
<br/>
<span class="m-wrap m-uneditable-input">Uneditable
You can also place text or buttons attached before or after any element.
To place stuff before an element, wrap them around a span
container
with the add-on
class. To set them before an element, wrap both the control and the add-on
container
with a m-input-prepend
class, to set the text after a element you can use m-input-append
.
Do note that when using m-input-prepend
you need to put the add-on
container before the element, with
m-input-append
you need to put it after the control.
Note: the textarea
, select
, input type="file"
,
input type="checkbox"
, and input type="radio"
elements are not supported.
<div class="m-input-prepend">
<span class="add-on">@</span>
<input class="m-wrap" size="16" type="text" placeholder="Twitter Username">
</div>
<br/>
<div class="m-input-append">
<input class="m-wrap" size="16" type="text" placeholder="">
<span class="add-on"><i class="icon-font"></i></span>
</div>
You can combine both the m-input-prepend
class and the m-input-append
class to place stuff before and after
an element.
<div class="m-input-prepend m-input-append">
<span class="add-on">@</span>
<input class="m-wrap" size="16" type="text" placeholder="Twitter Username">
<span class="add-on">Username
</div>
You can also place buttons instead of text.
<div class="m-input-append">
<input class="m-wrap" size="16" type="text" placeholder="Twitter Username">
<button href="#" class="m-btn">Search</button>
<button href="#" class="m-btn">Back</button>
</div>
<br/>
<div class="m-input-prepend">
<button href="#" class="m-btn blue">Login</button>
<input class="m-wrap" size="16" type="password" placeholder="Your Password">
</div>
Use the m-ctrl-small
, m-ctrl-medium
, and m-ctrl-large
to control the length of your textbox,
textarea and select elements. There's the m-ctrl-huge
class to create jumbo textboxes (textboxes with this
size does not support the append and prepend classes). However, do note that this class is only supported with the
input type="text"
element.
<input type="text" class="m-wrap m-ctrl-small" placeholder=".m-ctrl-small"/>
<br/>
<input type="text" class="m-wrap m-ctrl-medium" placeholder=".m-ctrl-medium"/>
<br/>
<input type="text" class="m-wrap m-ctrl-large" placeholder=".m-ctrl-large"/>
<br/>
<input type="text" class="m-wrap m-ctrl-huge" placeholder=".m-ctrl-huge"/>