alert only css
by Roshan Karunarathna
HTML
<script src="https://code.jquery.com/jquery-3.4.1.slim.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.css">
<!--
Bootstrap docs: https://getbootstrap.com/docs
-->
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="f-modal-alert">
<div class="f-modal-icon f-modal-error animate">
<span class="f-modal-x-mark">
<span class="f-modal-line f-modal-left animateXLeft"></span>
<span class="f-modal-line f-modal-right animateXRight"></span>
</span>
<div class="f-modal-placeholder"></div>
<div class="f-modal-fix"></div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="f-modal-alert">
<div class="f-modal-icon f-modal-warning scaleWarning">
<span class="f-modal-body pulseWarningIns"></span>
<span class="f-modal-dot pulseWarningIns"></span>
</div>
</div>
</div>
<div class="col-md-12">
<div class="f-modal-alert">
<div class="f-modal-icon f-modal-success animate">
<span class="f-modal-line f-modal-tip animateSuccessTip"></span>
<span class="f-modal-line f-modal-long animateSuccessLong"></span>
<div class="f-modal-placeholder"></div>
<div class="f-modal-fix"></div>
</div>
</div>
</div>
</div>
</div>
SCSS
.row {
background: #f8f9fa;
margin-top: 20px;
}
.col {
border: solid 1px #6c757d;
padding: 10px;
}
body {
background-color: rgba(0, 0, 0, .2);
}
.f-modal-alert {
background-color: #fff;
box-shadow: 0 0 10px 2px rgba(0,0,0,.2);
border-radius: 4px;
margin: 20px;
padding: 50px;
}
.f-modal-alert .f-modal-icon {
border-radius: 50%;
border: 4px solid gray;
box-sizing: content-box;
height: 80px;
margin: 20px auto;
padding: 0;
position: relative;
width: 80px;
// Success icon
&.f-modal-success,
&.f-modal-error {
border-color: #A5DC86;
&:after,
&:before {
background: #fff;
content: '';
height: 120px;
position: absolute;
transform: rotate(45deg);
width: 60px;
}
&:before {
border-radius: 120px 0 0 120px;
left: -33px;
top: -7px;
transform-origin: 60px 60px;
transform: rotate(-45deg);
}
&:after {
border-radius: 0 120px 120px 0;
left: 30px;
top: -11px;
transform-origin: 0 60px;
transform: rotate(-45deg);
}
.f-modal-placeholder {
border-radius: 50%;
border: 4px solid rgba(165, 220, 134, .2);
box-sizing: content-box;
height: 80px;
left: -4px;
position: absolute;
top: -4px;
width: 80px;
z-index: 2;
}
.f-modal-fix {
background-color: #fff;
height: 90px;
left: 28px;
position: absolute;
top: 8px;
transform: rotate(-45deg);
width: 5px;
z-index: 1;
}
.f-modal-line {
background-color: #A5DC86;
border-radius: 2px;
display: block;
height: 5px;
position: absolute;
z-index: 2;
&.f-modal-tip {
left: 14px;
top: 46px;
transform: rotate(45deg);
width: 25px;
}
&.f-modal-long {
right: 8px;
top: 38px;
transform: rotate(-45deg);
width: 47px;
}
}
}
// Error icon
&.f-modal-error {
border-color: #F27474;
.f-modal-x-mark {
display: block;
position: relative;
z-index: 2;
}
.f-modal-placeholder {
border: 4px solid rgba(200, 0, 0, .2);
}
.f-modal-line...