Description
The Bootstrap Button JavaScript plugin allows you to enhance the functionality of your buttons. You can control the state of buttons and create button groups for components, such as toolbars.
What is required
You must reference jquery.js and bootstrap-button.js - these two JavaScript files. They are all located inside the docs/assets/js folder.
How to use it
You can use the plugin just through markup without writing any JavaScript, or you can enable buttons through JavaScript.
Bootstrap provides some options to define the style of buttons, as shown in the following table:
The following styles can be used on ,
類別 | 描述 |
---|---|
.btn | 為按鈕新增基本樣式 |
.btn-default | 預設/標準按鈕 |
.btn-primary | 原始按鈕樣式(未操作) |
.btn-success | 表示成功的動作 |
.btn-info | 此樣式可用於要彈出資訊的按鈕 |
.btn-warning | 表示需要謹慎操作的按鈕 |
.btn-danger | 表示一個危險動作的按鈕操作 |
.btn-link | 讓按鈕看起來像連結 (仍然保留按鈕行為) |
.btn-lg | 製作一個大按鈕 |
.btn-sm | Make a small button |
.btn-xs | Make a super small button |
.btn-block | Block-level button (stretched to 100% of the width of the parent element) |
.active | Button clicked |
.disabled | Disable button |
先看下不同顏色的按鈕:
<html lang="en"> <head> <!--网站编码格式,UTF-8 国际编码,GBK或 gb2312 中文编码--> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="Keywords" content="关键词一,关键词二"> <meta name="Description" content="网站描述内容"> <meta name="Author" content="Yvette Lau"> <meta name = "viewport" content = " width = device-width, initial-scale = 1 "> <title>BootstrapDemo</title> <!--css js 文件的引入--> <link rel="stylesheet" type="text/css" href="../bootstrap-3.3.5-dist/css/bootstrap.min.css"> </head> <body style="padding: 20px;"> <!-- 标准的按钮 --> <button type="button" class="btn btn-default">默认按钮</button> <!-- 提供额外的视觉效果,标识一组按钮中的原始动作 --> <button type="button" class="btn btn-primary">原始按钮</button> <!-- 表示一个成功的或积极的动作 --> <button type="button" class="btn btn-success">成功按钮</button> <!-- 用于要弹出信息的按钮 --> <button type="button" class="btn btn-info">信息按钮</button> <!-- 表示应谨慎操作的动作 --> <button type="button" class="btn btn-warning">警告按钮</button> <!-- 表示一个危险动作的按钮 --> <button type="button" class="btn btn-danger">危险按钮</button> <!-- 让按钮看起来像一个链接,但同时保持按钮的行为 --> <button type="button" class="btn btn-link">链接按钮</button> </body> </html>
效果:
btn-default / btn-primary /btn-success/ btn-info/ btn-warning/ btn-danger/ btn-link為按鈕加上了不同的樣式。
按鈕大小
鑑於head部分都是相同的,只列出Body的內容。
<body style="padding: 20px;width:500px;"> <!-- 标准的按钮 --> <button type="button" class="btn btn-default">默认按钮</button> <button type="button" class="btn btn-lg btn-default">大的默认按钮</button> <br/><br/> <!-- 提供额外的视觉效果,标识一组按钮中的原始动作 --> <button type="button" class="btn btn-primary">原始按钮</button> <button type="button" class="btn btn-sm btn-primary">小的原始按钮</button> <br/><br/> <!-- 表示一个成功的或积极的动作 --> <button type="button" class="btn btn-success">成功按钮</button> <button type="button" class="btn btn-xs btn-success">特别小的成功按钮</button> <br/><br/> <!-- 用于要弹出信息的按钮 --> <button type="button" class="btn btn-info">信息按钮</button><br/><br/> <button type="button" class="btn btn-block btn-info">块级信息按钮</button> </body>
效果如下:
按鈕狀態
按鈕分為active和disabled兩種狀態、
啟動狀態:按鈕呈現被按壓的外觀,即背景顏色變深、深色邊框和陰影。
停用狀態:按鈕顏色會變淡 50%,並失去漸層
看具體的例子:
<body style="padding: 20px;width:500px;"> <!-- 标准的按钮 --> <button type="button" class="btn btn-default">默认按钮</button> <button type="button" class="btn btn-default active">激活的默认按钮</button> <br/><br/> <!-- 提供额外的视觉效果,标识一组按钮中的原始动作 --> <button type="button" class="btn btn-primary">原始按钮</button> <button type="button" class="btn btn-primary active">激活的原始按钮</button> <br/><br/> <!-- 表示一个成功的或积极的动作 --> <button type="button" class="btn btn-success">成功按钮</button> <button type="button" class="btn btn-success active">激活的成功按钮</button> <br/><br/> <!-- 用于要弹出信息的按钮 --> <button type="button" class="btn btn-info">信息按钮</button> <button type="button" class="btn btn-info active">激活的信息按钮</button> <br/><br/> <button type="button" class="btn btn-default">默认按钮</button> <button type="button" class="btn btn-default disabled">禁用的默认按钮</button> <br/><br/> <!-- 提供额外的视觉效果,标识一组按钮中的原始动作 --> <button type="button" class="btn btn-primary">原始按钮</button> <button type="button" class="btn btn-primary disabled">禁用的原始按钮</button> <br/><br/> <!-- 表示一个成功的或积极的动作 --> <button type="button" class="btn btn-success">成功按钮</button> <button type="button" class="btn btn-success disabled">禁用的成功按钮</button> <br/><br/> <!-- 用于要弹出信息的按钮 --> <button type="button" class="btn btn-info">信息按钮</button> <button type="button" class="btn btn-info disabled">禁用的信息按钮</button> </body>
按鈕標籤
a,input都可以表現的像一個按鈕,但是避免跨瀏覽器不一致,最好使用Button標籤。
<body style="padding: 20px;"> <a class="btn btn-default" href="#" role="button">超链接按钮</a> <button class="btn btn-default btn-primary" type="submit">button按钮</button> <input class="btn btn-default btn-success" type="button" value="input按钮"> <input class="btn btn-default btn-info" type="submit" value="submit按钮"> </body>
以上內容介紹了Bootstrap按鈕相關知識,希望大家喜歡。

Yes, the engine core of JavaScript is written in C. 1) The C language provides efficient performance and underlying control, which is suitable for the development of JavaScript engine. 2) Taking the V8 engine as an example, its core is written in C, combining the efficiency and object-oriented characteristics of C. 3) The working principle of the JavaScript engine includes parsing, compiling and execution, and the C language plays a key role in these processes.

JavaScript is at the heart of modern websites because it enhances the interactivity and dynamicity of web pages. 1) It allows to change content without refreshing the page, 2) manipulate web pages through DOMAPI, 3) support complex interactive effects such as animation and drag-and-drop, 4) optimize performance and best practices to improve user experience.

C and JavaScript achieve interoperability through WebAssembly. 1) C code is compiled into WebAssembly module and introduced into JavaScript environment to enhance computing power. 2) In game development, C handles physics engines and graphics rendering, and JavaScript is responsible for game logic and user interface.

JavaScript is widely used in websites, mobile applications, desktop applications and server-side programming. 1) In website development, JavaScript operates DOM together with HTML and CSS to achieve dynamic effects and supports frameworks such as jQuery and React. 2) Through ReactNative and Ionic, JavaScript is used to develop cross-platform mobile applications. 3) The Electron framework enables JavaScript to build desktop applications. 4) Node.js allows JavaScript to run on the server side and supports high concurrent requests.

Python is more suitable for data science and automation, while JavaScript is more suitable for front-end and full-stack development. 1. Python performs well in data science and machine learning, using libraries such as NumPy and Pandas for data processing and modeling. 2. Python is concise and efficient in automation and scripting. 3. JavaScript is indispensable in front-end development and is used to build dynamic web pages and single-page applications. 4. JavaScript plays a role in back-end development through Node.js and supports full-stack development.

C and C play a vital role in the JavaScript engine, mainly used to implement interpreters and JIT compilers. 1) C is used to parse JavaScript source code and generate an abstract syntax tree. 2) C is responsible for generating and executing bytecode. 3) C implements the JIT compiler, optimizes and compiles hot-spot code at runtime, and significantly improves the execution efficiency of JavaScript.

JavaScript's application in the real world includes front-end and back-end development. 1) Display front-end applications by building a TODO list application, involving DOM operations and event processing. 2) Build RESTfulAPI through Node.js and Express to demonstrate back-end applications.

The main uses of JavaScript in web development include client interaction, form verification and asynchronous communication. 1) Dynamic content update and user interaction through DOM operations; 2) Client verification is carried out before the user submits data to improve the user experience; 3) Refreshless communication with the server is achieved through AJAX technology.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version
SublimeText3 Linux latest version

Notepad++7.3.1
Easy-to-use and free code editor

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
