buttons-inline.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>jQuery Mobile Docs - Inline buttons</title>
  7. <link rel="stylesheet" href="../../jquery.mobile-1.0.1.min.css" />
  8. <link rel="stylesheet" href="../_assets/css/jqm-docs.css"/>
  9. <script src="../../jquery.js"></script>
  10. <script src="../../experiments/themeswitcher/jquery.mobile.themeswitcher.js"></script>
  11. <script src="../_assets/js/jqm-docs.js"></script>
  12. <script src="../../jquery.mobile-1.0.1.min.js"></script>
  13. </head>
  14. <body>
  15. <div data-role="page" class="type-interior">
  16. <div data-role="header" data-theme="f">
  17. <h1>Inline buttons</h1>
  18. <a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
  19. </div><!-- /header -->
  20. <div data-role="content">
  21. <div class="content-primary">
  22. <p>By default, all buttons in the body content are styled as block-level element so they fill the width of the screen:</p>
  23. <a href="index.html" data-role="button">Button</a>
  24. <p>However, if you want a more compact button that is only as wide as the text and icons inside, add the <code> data-inline="true"</code> attribute to the button:</p>
  25. <a href="index.html" data-role="button" data-inline="true">Button</a>
  26. <p>If you have multiple buttons that should sit side-by-side on the same line, add the <code> data-inline="true"</code> attribute to each button. This will style the buttons to be the width of their content and float the buttons so they sit on the same line. </p>
  27. <pre><code>
  28. &lt;a href=&quot;index.html&quot; data-role=&quot;button&quot; data-inline=&quot;true&quot;&gt;Cancel&lt;/a&gt;
  29. &lt;a href=&quot;index.html&quot; data-role=&quot;button&quot; data-inline=&quot;true&quot; data-theme=&quot;b&quot;&gt;Save&lt;/a&gt;
  30. </code></pre>
  31. <p>The result is this:</p>
  32. <a href="index.html" data-role="button" data-inline="true">Cancel</a>
  33. <a href="index.html" data-role="button" data-theme="b" data-inline="true">Save</a>
  34. <p>If you want buttons to sit side-by-side but stretch to fill the width of the screen, you can use the <a href="../content/content-grids.html">content column grids</a> to put normal full-width buttons into 2- or 3-columns.</p>
  35. </div><!--/content-primary -->
  36. <div class="content-secondary">
  37. <div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
  38. <h3>More in this section</h3>
  39. <ul data-role="listview" data-theme="c" data-dividertheme="d">
  40. <li data-role="list-divider">Buttons</li>
  41. <li><a href="buttons-types.html">Button basics</a></li>
  42. <li><a href="buttons-icons.html">Button icons</a></li>
  43. <li data-theme="a"><a href="buttons-inline.html">Inline buttons</a></li>
  44. <li><a href="buttons-grouped.html">Grouped buttons</a></li>
  45. <li><a href="buttons-themes.html">Theming buttons</a></li>
  46. </ul>
  47. </div>
  48. </div>
  49. </div><!-- /content -->
  50. <div data-role="footer" class="footer-docs" data-theme="c">
  51. <p>&copy; 2011-2012 The jQuery Project</p>
  52. </div>
  53. </div><!-- /page -->
  54. </body>
  55. </html>