alert
bootstrap5.css
bootstrap5.css
.alert {
position: relative;
padding: 0.75rem 1.25rem;
margin-bottom: 1rem;
border: 1px solid transparent;
border-radius: 0.25rem;
}
bootstrap5.css
.alert-heading {
color: inherit;
}
bootstrap5.css
.alert-link {
font-weight: 700;
}
bootstrap5.css
.alert-dismissible {
padding-right: 4rem;
}
bootstrap5.css
.alert-dismissible .close {
position: absolute;
top: 0;
right: 0;
padding: 0.75rem 1.25rem;
color: inherit;
}
bootstrap5.css
.alert-primary {
color: #004085;
background-color: #cce5ff;
border-color: #b8daff;
}
bootstrap5.css
.alert-primary hr {
border-top-color: #9fcdff;
}
bootstrap5.css
.alert-primary .alert-link {
color: #002752;
}
bootstrap5.css
.alert-secondary {
color: #383d41;
background-color: #e2e3e5;
border-color: #d6d8db;
}
bootstrap5.css
.alert-secondary hr {
border-top-color: #c8cbcf;
}
bootstrap5.css
.alert-secondary .alert-link {
color: #202326;
}
bootstrap5.css
.alert-success {
color: #155724;
background-color: #d4edda;
border-color: #c3e6cb;
}
bootstrap5.css
.alert-success hr {
border-top-color: #b1dfbb;
}
bootstrap5.css
.alert-success .alert-link {
color: #0b2e13;
}
bootstrap5.css
.alert-info {
color: #0c5460;
background-color: #d1ecf1;
border-color: #bee5eb;
}
bootstrap5.css
.alert-info hr {
border-top-color: #abdde5;
}
bootstrap5.css
.alert-info .alert-link {
color: #062c33;
}
bootstrap5.css
.alert-warning {
color: #856404;
background-color: #fff3cd;
border-color: #ffeeba;
}
bootstrap5.css
.alert-warning hr {
border-top-color: #ffe8a1;
}
bootstrap5.css
.alert-warning .alert-link {
color: #533f03;
}
bootstrap5.css
.alert-danger {
color: #721c24;
background-color: #f8d7da;
border-color: #f5c6cb;
}
bootstrap5.css
.alert-danger hr {
border-top-color: #f1b0b7;
}
bootstrap5.css
.alert-danger .alert-link {
color: #491217;
}
bootstrap5.css
.alert-light {
color: #818182;
background-color: #fefefe;
border-color: #fdfdfe;
}
bootstrap5.css
.alert-light hr {
border-top-color: #ececf6;
}
bootstrap5.css
.alert-light .alert-link {
color: #686868;
}
bootstrap5.css
.alert-dark {
color: #1b1e21;
background-color: #d6d8d9;
border-color: #c6c8ca;
}
bootstrap5.css
.alert-dark hr {
border-top-color: #b9bbbe;
}
bootstrap5.css
.alert-dark .alert-link {
color: #040505;
}
html bootstrap5 Sample
アラートの背景色:alert-*
alert-primary
alert-secondary
alert-success
alert-danger
alert-warning
alert-info
alert-light
alert-dark
<div class="alert alert-primary" role="alert">alert-primary</div>
<div class="alert alert-secondary" role="alert">alert-secondary</div>
<div class="alert alert-success" role="alert">alert-success</div>
<div class="alert alert-danger" role="alert">alert-danger</div>
<div class="alert alert-warning" role="alert">alert-warning</div>
<div class="alert alert-info" role="alert">alert-info</div>
<div class="alert alert-light" role="alert">alert-light</div>
<div class="alert alert-dark" role="alert">alert-dark</div>
アラートを閉じるボタンで消す:alert-dismissible
右側の「×」マークをクリックするとアラートが閉じます
<div class="alert alert-warning alert-dismissible fade show" role="alert">
右側の「×」マークをクリックするとアラートが閉じます
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>