Link Buttons

Description

Link buttons are the most commonly used type of button.

Whenever you need to style an ordinary link as a button, add the data-role="button" attribute to the link.

By default, buttons within the content section of a page are styled as block-level elements so they will fill the entire width of their outer container.

However, if you want a more compact button that is only as wide as the text and icons inside, add the data-inline="true" attribute.

Example


<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Buttons</title>
<meta name="viewport"
  content="width=device-width, minimum-scale=1.0, maximum-scale=1.0;">
<link rel="stylesheet"
  href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
</head><!--from   ww w  .j  a v  a  2s.c  om-->
<body>
  <div data-role="page" data-theme="b">
    <div data-role="header">
      <h1>Basic Buttons</h1>
    </div>
    <div data-role="content">
      <p style="text-align: center;">
        <a href="#" data-role="button">Link button</a> <br> <br>
        <a href="#" data-role="button" data-inline="true" data-rel="back"
          data-theme="a">Disagree</a> 
        <a href="#" data-role="button"
          data-inline="true" data-theme="c">Agree</a>
      </p>
    </div>
  </div>
</body>
</html>

Click to view the demo





















Home »
  jQuery Mobile »
    Tutorial »




jQuery_Mobile
Form
List
Layout
Theme