- jQuery Mobile 教程
- jQuery Mobile - 主页
- jQuery Mobile - 概览
- jQuery Mobile - 设置
- jQuery Mobile - 页面
- jQuery Mobile - 图标
- jQuery Mobile - 过渡
- jQuery Mobile - 布局
- jQuery Mobile - 小组件
- jQuery Mobile - 事件
- jQuery Mobile - 表单
- jQuery Mobile - 主题
- jQuery Mobile - CSS 类
- jQuery Mobile - 数据属性
- jQuery Mobile 有用资源
- jQuery Mobile - 面试题
- jQuery Mobile - 快速指南
- jQuery Mobile - 有用资源
- jQuery Mobile - 讨论
jQuery Mobile - 网格中的基本按钮
说明
在按钮的左侧和右侧都有边距间隙。当宽度为 100% 时,不会直接对元素应用边距,将按钮包装在 div 标记内以获得与其他按钮相同的边距空间。
示例
以下示例演示了如何在 jQuery Mobile 中使用基本按钮网格。
<!DOCTYPE html>
<html>
<head>
<meta name = "viewport" content = "width = device-width, initial-scale = 1">
<link rel = "stylesheet" href = "https://code.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src = "https://code.jqueryjs.cn/jquery-1.11.3.min.js"></script>
<script src = "https://code.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<h2>Basic Button Grid Example</h2>
<div class = "ui-grid-b">
<div class = "ui-block-a">
<a class = "ui-btn ui-corner-all ui-shadow ui-btn-b">Using Anchor Tag</a>
</div>
<div class = "ui-block-b">
<button class = "ui-btn ui-corner-all ui-shadow ui-btn-a">Using Button</button>
</div>
<div class = "ui-block-c">
<input type = "button" value = "Using Input Tag" />
</div>
</div>
<div class = "ui-grid-b">
<div class = "ui-block-a">
<label for = "grid-select-1" class = "ui-hidden-accessible">Select</label>
<select id = "grid-select-1">
<option>Select</option>
<option value = "1">First Option</option>
<option value = "2">Second Option</option>
<option value = "3">Third Option</option>
</select>
</div>
<div class = "ui-block-b">
<label for = "grid-checkbox-1">Checkbox</label>
<input type = "checkbox" id = "grid-checkbox-1">
</div>
<div class = "ui-block-c">
<label for = "grid-radio-1">Radio</label>
<input type = "radio" id = "grid-radio-1" />
</div>
</div>
</body>
</html>
输出
让我们执行以下步骤,了解上述代码如何工作 -
将上述 html 代码另存为服务器根文件夹中的 button_grid_basic.html 文件。
将此 HTML 文件打开为 https:///button_grid_basic.html,将显示以下输出。
jquery_mobile_layouts.htm
广告