button
.button-primary + .button-secondary
A primary button is commonly used for a user action; a secondary button may then be used to close out.
<button type=”button” class=”btn btn-primary”>Primary</button>
<button type=”button” class=”btn btn-secondary”>Secondary</button>
.btn-light, -dark .btn-primary, -secondary, -transparent, -white,
-warning, -success, -info, -danger
Design your buttons using the standard predefined styling options:
<button type=”button” class=”btn btn-light”>Light</button>
<button type=”button” class=”btn btn-dark”>Dark</button>
<button type=”button” class=”btn btn-success”>Success</button>
<button type=”button” class=”btn btn-info”>Info</button>
<button type=”button” class=”btn btn-danger”>Danger</button>
<button type=”button” class=”btn btn-warning”>Warning</button>
<button type=”button” class=“button-transparent”>Transparent</button>
<button type=”button” class=“button-white”>White</button>
.btn-outline
Choose a button outline following these snippet samples:
<button type=”button” class=”btn btn-outline-primary”>Primary</button>
.btn-lg + .btn-sm
Change the size of your buttons.
<button type=”button” class=”btn btn-primary btn-lg”>I’m the large button</button>
<button type=”button” class=”btn btn-primary btn-sm”>I’m a small button</button>
.btn-block
Group your buttons into a block. All grouped buttons will span the full width of a parent.
<button type=”button” class=”btn btn-primary btn-lg btn-block”>Block level button</
button>
.active
By default, all buttons will be displayed as pressed - with a dark border, darker background and inset shadow - when
active.
You don’t need to add a class to <button>s as they use a pseudo-class.
But, if for some reason, you need to force that same active look, use the following code snippet:
<a href=”#!” class=”btn btn-primary btn-lg active” role=”button” ariapressed=”true”>Primary link</a>
Note: You can also add the disabled Boolean attribute to any button to make it look inactive.
<button type=”button” class=”btn btn-lg btn-primary” disabled>Disabled button</
4.14
7
<html>
<head>
<style>
.button {
background-color: <background color>;
border: none;
color: <text color>;
padding: 10px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 4px;
cursor: pointer;
border-radius: 8px;
}
</style>
</head>
<body>
<a href="<url>" class="button">ButtonText</a>
</body>
</html>
Thank you!
7
0
4.5
2
<androidx.appcompat.widget.AppCompatButton
android:text="ok"
android:id="@+id/appcompatbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="150dp"/>
Thank you!
2
0
3.86
7
<a href="#" class="myButton">Search</a>
.myButton {
background:linear-gradient(to bottom, #8ca0c2 5%, #476e9e 100%);
background-color:#8ca0c2;
border-radius:13px;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-family:Times New Roman;
font-size:16px;
font-weight:bold;
padding:10px 15px;
text-decoration:none;
&:hover {
background:linear-gradient(to bottom, #476e9e 5%, #8ca0c2 100%);
background-color:#476e9e;
}
&:active {
position:relative;
top:1px;
}
}
Thank you!
7
0
4.5
4
const button = document.querySelector('main button');
const output = document.querySelector('main pre');
button.addEventListener('click', function (e) {
console.log('button is clicked');
output.innerHTML += 'button is clicked<br>';
});
Thank you!
4
0
3.78
9
<androidx.appcompat.widget.AppCompatButton
Thank you!
9
0
Are there any code examples left?
New code examples in category CSS