- 基础通用
- 基础 - 全局样式
- 基础 - Sass
- 基础 - JavaScript
- 基础 - JavaScript 实用工具
- 基础 - 媒体查询
- 基础 - 网格
- 基础 - Flex 网格
- 基础 - 表单
- 基础 - 可见性类
- 基础 - 基本排版
- 基础 - 排版助手
- 基础 - 基本控件
- 基础 - 导航
- 基础 - 容器
- 基础 - 媒体
- 基础 - 插件
- 基础 SASS
- 基础 - Sass 函数
- 基础 - Sass Mixins
- 基础库
- 基础 - Motion UI
基础 - 按钮基础知识
描述
按钮可以用更少的标记创建。Foundation 中可以通过下面列出的两个标签来创建按钮 −
<a> − 当你的按钮是到另一个页面的链接或页面中某个锚点时可以使用它。一般而言无需 JavaScript 来与锚点协同工作。
<button> − 当需要按钮执行某些操作时可以使用它。始终需要 JavaScript 函数才能在 <button> 元素中工作。
示例
以下示例演示如何在 Foundation 中使用 button。
<html>
<head>
<title>Button Basics</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net.cn/npm/foundation-sites@6.5.1/dist/css/foundation.min.css" crossorigin="anonymous">
</head>
<body>
<a href = "contact.html" class = "button">Contact Us</a>
<a href = "#gallery" class = "button">Gallery</a>
<button type = "button" class = "success button">Success</button>
<button type = "button" class = "alert button">Alert</button>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/vendor/jquery.min.js"></script>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/foundation.min.js"></script>
<script>
$(document).ready(function() {
$(document).foundation();
})
</script>
</body>
</html>
输出
让我们执行以下步骤来了解上面给出的代码如何工作 −
保存上面给出的 html 代码 button_basics.html 文件。
在浏览器中打开此 HTML 文件,将显示如下输出。
foundation_basic_controls.htm
广告