jQuery Mobile: Inline only buttons using Icons

This entry is part 42 of 73 in the series jQuery Mobile

Here we work out some mini-size buttons using only the icons.

Buttons Using Icons
<!DOCTYPE html>
<html>
<head>
    <link href='http://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.min.css' rel='stylesheet'/>
    <script src='http://code.jquery.com/jquery-1.10.2.min.js'></script>
    <script src='http://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.min.js'></script>
    <style>
        .center {
            text-align: center;
        }
    </style>
    <title>Codecrawl</title>
</head>
<body>
<div data-role='page'>
    <div data-role='header'><h1>Grid A</h1></div>
    <br>
    <div class='ui-grid-d center'>
        <div class='ui-block-a'><a class='ui-shadow ui-btn ui-corner-all ui-icon-home ui-btn-icon-notext ui-btn-inline'>Button</a></div>
        <div class='ui-block-b'><a class='ui-shadow ui-btn ui-corner-all ui-icon-arrow-l ui-btn-icon-notext ui-btn-inline'>Button</a></div>
        <div class='ui-block-c'><a class='ui-shadow ui-btn ui-corner-all ui-icon-grid ui-btn-icon-notext ui-btn-inline'>Button</a></div>
        <div class='ui-block-d'><a class='ui-shadow ui-btn ui-corner-all ui-icon-arrow-r ui-btn-icon-notext ui-btn-inline'>Button</a></div>
        <div class='ui-block-e'><a class='ui-shadow ui-btn ui-corner-all ui-icon-gear ui-btn-icon-notext ui-btn-inline'>Button</a></div>
    </div>

    <div data-role='footer' data-position='fixed'>
        <h1>Footer</h1>
    </div>
</div>
</body>

</html>
Try The Code

Notice the icons have been centered using text-align:center.
Icon Buttons Output

Series Navigation<< jQuery Mobile: One button or solo grid
jQuery Mobile: Header and content >>

Leave a comment

Leave a Reply