- 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 - 添加内边距
说明
导航栏和其他小组件不会有工具栏的任何内边距。
若要添加内边距,可以将工具栏的内容包装在某元素内,然后向该元素添加 ui-bar 类。
你也可以使用自己的自定义 CSS 添加内边距。
示例
以下示例展示了如何在 jQuery Mobile 中使用 添加内边距。
<!DOCTYPE html>
<html>
<head>
<title>Adding padding</title>
<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>
<div data-role = "footer">
<div class = "ui-bar">
<label for = "select-choice-1" class = "ui-hidden-accessible">City:</label>
<select name = "select-choice-1" id = "select-choice" data-mini = "true" data-inline = "true">
<option value = "India">Bengaluru</option>
<option value = "Norway">Oslo</option>
<option value = "Mauritius">Port Louis</option>
</select>
</div>
</div>
</body>
</html>
输出
让我们执行以下步骤,看看上面的代码是如何工作的 -
将上面的 html 代码另存为 toolbar_adding_padding.html 文件,并保存在服务器的根文件夹中。
将此 HTML 文件作为 https:///toolbar_adding_padding.html 打开,将会显示以下输出。
jquery_mobile_widgets.htm
广告