<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<div id="flash" class="center active error">
<div class="flash-message">
Please enter an email. Please enter an email. Please enter an email. Please enter an email. Please enter an email. Please enter an email.
</div>
<div class="flash-close">x</div>
</div>
CSS
// Flash messages
#flash {
// Display it as an offset from the parent <body> tag
position: absolute;
display: block;
top: 4em;
left: 0;
right: 0;
// Center it on the page
width: 50%;
text-align: center;
z-index: 101;
line-height: 2.5;
overflow: hidden;
// Cool shadows
-webkit-box-shadow: 0 0 5px $black;
-moz-box-shadow: 0 0 5px $black;
box-shadow: 0 0 5px $black;
border-radius: 3px;
}
// Set color based on message type
&.error { background: $mustard; }
&.notice { background: $light-green; }
.flash-message {
display: inline-block;
width: 80%;
padding-left: (100% - 80%)/2;
// Give it 3px on the top and bottom for some space
margin: 3px 0;
}
.flash-close {
display: inline-block;
// This doesn't seem to do anything.... -_-
// I've also tried auto-setting margins, and making it `position: relative`
// so I can set top/bottom as 50%
vertical-align: middle;
// Give it 3px on the top and bottom for some space
// Also 11px from the right edge
margin: 3px 11px 3px 0;
// Styling the "X" and the box around it
padding: 2px 6px;
font-family: Arial, sans-serif;
font-size: 1em;
font-weight: normal;
color: $white;
line-height: 1;
border: 1px solid rgba(255,255,255,0.2);
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.