Input range slider progress for Chrome browser - css

I am working on an input type range slider. I found out that the Chrome version of input[type=range]::-moz-range-thumb is input[type=range]::-webkit-slider-thumb .
Now, I want the same for input[type=range]::-moz-range-progress.
I have tried input[type=range]::-webkit-slider-progress , input[type=range]::-webkit-slider-runnable-progress .
Still not working so far. Any alternative?

It is totally possible with CSS only.
This dude has done it: https://codepen.io/ShadowShahriar/pen/zYPPYrQ
HTML:
<main>
<input type="range" class="win10-thumb" />
<input type="range" class="win10-thumb" min="0" max="100" value="25" step="5" />
<input type="range" class="win10-thumb" disabled value="64" />
<input type="range" />
<input type="range" min="0" max="100" value="40" step="5" />
<input type="range" disabled value="80" />
</main>
CSS:
html,
body {
height: 100%;
}
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
display: grid;
place-items: center;
}
main {
display: flex;
flex-direction: column;
gap: 2.2em;
padding: 1em 0;
}
html::before {
content: "";
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
background: radial-gradient(circle at center, #fff, #fafafa);
display: block;
}
/* === range theme and appearance === */
input[type="range"] {
font-size: 1.5rem;
width: 12.5em;
}
input[type="range"] {
color: #ef233c;
--thumb-height: 1.125em;
--track-height: 0.125em;
--track-color: rgba(0, 0, 0, 0.2);
--brightness-hover: 180%;
--brightness-down: 80%;
--clip-edges: 0.125em;
}
input[type="range"].win10-thumb {
color: #2b2d42;
--thumb-height: 1.375em;
--thumb-width: 0.5em;
--clip-edges: 0.0125em;
}
#media (prefers-color-scheme: dark) {
html {
background-color: #000;
}
html::before {
background: radial-gradient(circle at center, #101112, #000);
}
input[type="range"] {
color: #f07167;
--track-color: rgba(255, 255, 255, 0.1);
}
input[type="range"].win10-thumb {
color: #3a86ff;
}
}
/* === range commons === */
input[type="range"] {
position: relative;
background: #fff0;
overflow: hidden;
}
input[type="range"]:active {
cursor: grabbing;
}
input[type="range"]:disabled {
filter: grayscale(1);
opacity: 0.3;
cursor: not-allowed;
}
/* === WebKit specific styles === */
input[type="range"],
input[type="range"]::-webkit-slider-runnable-track,
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
transition: all ease 100ms;
height: var(--thumb-height);
}
input[type="range"]::-webkit-slider-runnable-track,
input[type="range"]::-webkit-slider-thumb {
position: relative;
}
input[type="range"]::-webkit-slider-thumb {
--thumb-radius: calc((var(--thumb-height) * 0.5) - 1px);
--clip-top: calc((var(--thumb-height) - var(--track-height)) * 0.5 - 0.5px);
--clip-bottom: calc(var(--thumb-height) - var(--clip-top));
--clip-further: calc(100% + 1px);
--box-fill: calc(-100vmax - var(--thumb-width, var(--thumb-height))) 0 0
100vmax currentColor;
width: var(--thumb-width, var(--thumb-height));
background: linear-gradient(currentColor 0 0) scroll no-repeat left center /
50% calc(var(--track-height) + 1px);
background-color: currentColor;
box-shadow: var(--box-fill);
border-radius: var(--thumb-width, var(--thumb-height));
filter: brightness(100%);
clip-path: polygon(
100% -1px,
var(--clip-edges) -1px,
0 var(--clip-top),
-100vmax var(--clip-top),
-100vmax var(--clip-bottom),
0 var(--clip-bottom),
var(--clip-edges) 100%,
var(--clip-further) var(--clip-further)
);
}
input[type="range"]:hover::-webkit-slider-thumb {
filter: brightness(var(--brightness-hover));
cursor: grab;
}
input[type="range"]:active::-webkit-slider-thumb {
filter: brightness(var(--brightness-down));
cursor: grabbing;
}
input[type="range"]::-webkit-slider-runnable-track {
background: linear-gradient(var(--track-color) 0 0) scroll no-repeat center /
100% calc(var(--track-height) + 1px);
}
input[type="range"]:disabled::-webkit-slider-thumb {
cursor: not-allowed;
}
/* === Firefox specific styles === */
input[type="range"],
input[type="range"]::-moz-range-track,
input[type="range"]::-moz-range-thumb {
appearance: none;
transition: all ease 100ms;
height: var(--thumb-height);
}
input[type="range"]::-moz-range-track,
input[type="range"]::-moz-range-thumb,
input[type="range"]::-moz-range-progress {
background: #fff0;
}
input[type="range"]::-moz-range-thumb {
background: currentColor;
border: 0;
width: var(--thumb-width, var(--thumb-height));
border-radius: var(--thumb-width, var(--thumb-height));
cursor: grab;
}
input[type="range"]:active::-moz-range-thumb {
cursor: grabbing;
}
input[type="range"]::-moz-range-track {
width: 100%;
background: var(--track-color);
}
input[type="range"]::-moz-range-progress {
appearance: none;
background: currentColor;
transition-delay: 30ms;
}
input[type="range"]::-moz-range-track,
input[type="range"]::-moz-range-progress {
height: calc(var(--track-height) + 1px);
border-radius: var(--track-height);
}
input[type="range"]::-moz-range-thumb,
input[type="range"]::-moz-range-progress {
filter: brightness(100%);
}
input[type="range"]:hover::-moz-range-thumb,
input[type="range"]:hover::-moz-range-progress {
filter: brightness(var(--brightness-hover));
}
input[type="range"]:active::-moz-range-thumb,
input[type="range"]:active::-moz-range-progress {
filter: brightness(var(--brightness-down));
}
input[type="range"]:disabled::-moz-range-thumb {
cursor: not-allowed;
}

On Internet Explorer you can use ::-ms-fill-lower to do this thing and firefox supports ::-moz-range-progress, but on chrome this is not possible only using css.
However, there is a good example below using JS.
It changes the background of the range element using linear-gradient.
https://codepen.io/duplich/pen/qjYQEZ

Related

Input text disappear while hover and typing

I can't seem to find the issue I'm using Gatsby and I created a Ref for handling form validation on the input, pretty basic stuff gone wrong for some reason
Here is the html:
<form onSubmit={(event) => handleSubmit(event, email)}>
<label htmlFor="email">Our newsletter</label>
<input
value={email || ''}
name="email"
placeholder="La tua e-mail"
type="text"
spellCheck="false"
className="input"
onChange={() => setEmail(myRef.current.value)}
ref={myRef}
/>
<button className="button" onClick={checkInput} type="submit">
Iscriviti
</button>
{message && (
<>
<br />
<small>{message.substring(0, 45)}</small>
</>
)}
</form>
These are the functions
const [message, setMessage] = useState();
const [email, setEmail] = useState('');
let myRef = useRef();
function handleSubmit(event, email) {
event.preventDefault();
addToMailchimp(email) // listFields are optional if you are only capturing the email address.
.then((data) => {
// I recommend setting data to React state
// but you can do whatever you want (including ignoring this `then()` altogether)
setMessage(data.msg);
})
.catch(() => {
// unnecessary because Mailchimp only ever
// returns a 200 status code
// see below for how to handle errors
});
}
const checkInput = () => {
console.log(myRef);
if (myRef.current.value === '') {
setErrorFor();
} else if (!isEmail(myRef.current.value)) {
setErrorFor();
} else {
setSuccessFor();
}
};
function setErrorFor() {
const formControl = myRef.current;
formControl.className = 'error shaka';
}
function setSuccessFor() {
const formControl = myRef.current;
formControl.className = 'success';
}
function isEmail(email) {
return /^(([^<>()\[\]\\.,;:\s#"]+(\.[^<>()\[\]\\.,;:\s#"]+)*)|(".+"))#((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
email
);
}
This is the CSS
form {
display: flex;
justify-content: space-between;
align-items: flex-start;
flex-direction: column;
width: 45%;
#media only screen and (max-width: 699px) {
width: 100%;
text-align: center;
}
label {
font-size: calc(1.3rem + (24 - 14) * ((100vw - 300px) / (1600 - 300)));
text-transform: uppercase;
font-weight: bolder;
font-family: 'Acme', sans-serif;
letter-spacing: 0.1rem;
#media only screen and (max-width: 699px) {
text-align: center;
margin: 4rem auto 0 auto;
font-size: calc(2rem + (24 - 14) * ((100vw - 300px) / (1600 - 300)));
}
}
}
input {
width: 100%;
max-width: 320px;
min-width: 150px;
border: none;
padding: 0.5rem;
border-radius: 3px;
margin-top: 1rem;
height: 2.5rem;
font-size: 1rem;
color: black;
#media only screen and (max-width: 699px) {
width: 100%;
min-width: 100%;
}
}
.button {
height: 2.5rem;
border: 1px solid white;
margin-top: 1rem;
width: 100%;
max-width: 320px;
min-width: 150px;
cursor: pointer;
padding: 0.5rem;
border-radius: 3px;
background-color: cornflowerblue;
color: white;
font-size: 1.3rem;
font-family: 'Acme', sans-serif;
#media only screen and (max-width: 699px) {
width: 100%;
min-width: 100%;
}
}
.success {
border: 2px solid $maingreen;
}
.error {
border: 2px solid red;
}
.input {
z-index: 5;
outline: none;
:focus,
:hover {
outline: none;
text-rendering: optimizeLegibility;
text-indent: inherit;
z-index: 5000000000000000000000;
display: flex;
font-size: inherit;
color: inherit;
}
}
.input:hover {
z-index: 5;
color: inherit;
}
.shaka {
animation: shake 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
transform: translate3d(0, 0, 0);
backface-visibility: hidden;
perspective: 1000px;
animation-duration: 1s;
}
#keyframes shake {
10%,
90% {
transform: translate3d(-1px, 0, 0);
}
20%,
80% {
transform: translate3d(2px, 0, 0);
}
30%,
50%,
70% {
transform: translate3d(-4px, 0, 0);
}
40%,
60% {
transform: translate3d(4px, 0, 0);
}
}
}
Live example: don't know what that black border is, perhaps after validating it it works normally, same story on all browsers
If you ever notice the same problem happening to you, I would like to know what's happening. Thank you
I dont understand why u use z-index to the input,
remove that and the z-index in the input:hover
Disappearing text on hover for me I looks like it get the color from inherit, change inherit to a color like #000.
.input:hover {
z-index: 5;
color: inherit;
}

Autofill with LinkedIn form

I have applied the Linked Autofill function but I have 2 questions about it:
Here is the page link : The page is hosted on HubSpot CMS - https://inboundmarketing.inboundmantra.com/inbound-marketing-company-contact-inbound-mantra
Here is code of the linkedIn autofill button for the above page:
<button id="autofill-button">
<span class="logo">IN</span>
<div class="button-text-container">
<span class="button-text">
AutoFill with <strong>LinkedIn</strong>
</span>
</div>
</button>
<style>
#autofill-button {
height: 33px;
width: 174px;
cursor: pointer;
color: #FFF;
padding: 0;
border: 1px #2D6FA8 solid;
border-radius: 3px;
font-size: 12px;
position: relative;
overflow: hidden;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
background: #79adcb;
background: -webkit-linear-gradient(top, #79adcb 15%, #2373ac 100%);
background: linear-gradient(to bottom, #79adcb 15%, #2373ac 100%);
-ms-user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
font-family: Arial;
font-size: 12px;
display: inline-block;
}
#autofill-button:hover {
background: #5a8193;
background: -webkit-linear-gradient(top, #5a8193 15%, #1e4d72 100%);
background: linear-gradient(to bottom, #5a8193 15%, #1e4d72 100%);
}
#autofill-button:active {
background: #1e4d72;
background: -webkit-linear-gradient(top, #1e4d72 15%, #5a8193 100%);
background: linear-gradient(to bottom, #1e4d72 15%, #5a8193 100%);
}
#autofill-button .logo {
position: absolute;
top: 0;
bottom: 0;
right: 0;
width: 34px;
color: transparent;
background: url(https://www.linkedin.com/scds/common/u/img/sprite/sprite_connect_v13.png) no-repeat scroll 0 -347px transparent;
}
#autofill-button .button-text-container {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: table;
width: 171px;
height: 33px;
}
#autofill-button .button-text {
display: table-cell;
vertical-align: middle;
}
span.IN-widget {
height: 0 !important;
visibility: hidden;
opacity: 0;
}
</style>
<script>
$('#autofill-button').click(function(){
$('span.IN-widget *').click();
});
</script>
<script type="in/Login"></script>
<script type="text/javascript" src="//platform.linkedin.com/in.js">// <![CDATA[
api_key: 81ndwffuhqmres
authorize: false
lang: en_US
</script>
<script>
setTimeout(function(){
var callbackScope, extraData;
function callback(args) {
var fields = ['first-name', 'last-name', 'email-address', 'id', 'headline', 'pictureUrl', 'positions', 'num-connections'];
IN.API.Profile("me").fields(fields).result(function(profiles) {
member = profiles.values[0];
console.log(member);
$('[id*="firstname"]').val(member.firstName);
$('[id*="lastname"]').val(member.lastName);
$('[id*="email"]').val(member.emailAddress);
$('#headline').val(member.headline);
$('#picture').attr("src", member.pictureUrl);
var i = 0;
for (position of member.positions.values) {
$('#position' + (i++)).val(position.company.name + " - " + position.title);
}
}).error(function(data) {
console.log(data);
});
}
IN.Event.on(IN, 'auth', callback, callbackScope, extraData);
},500);
</script>
There are entire fields autofilled but the phone number field is not working.
This code is not working when I'm running this code in WordPress.
Here is the page link : https://www.inboundmantra.com/predictive-lead-scoring
Please let me know how to fix it.
Thanks in advance...
have you whitelisted your domain? you need to contact a linkedin representative to whitelist your domain in order to use this feature.

CSS - Custom cursor that changes depending on hovered element flickers when moving left to right but not right to left

I am trying to create a custom cursor that changes when hovering over a <div>, but there is a flicker when moving left to right across it, but not when moving right to left. Why this is happening and what I can do to fix it?
document.addEventListener('mousemove', (ev) => cursorMove(ev));
function cursorMove(ev) {
let circle = document.getElementById('circle');
let posY = ev.clientY;
let posX = ev.clientX;
circle.style.top = posY + 'px';
circle.style.left = posX + 'px';
}
body {
margin: 0;
height: 100vh;
background-color: #acd1d2;
position: relative;
display: flex;
justify-content: center;
align-items: center;
font-family: monospace;
}
#wrapper {
position: relative;
width: 70%;
height: 80%;
}
.box {
height: 25%;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
}
#box-1 {
background-color: #e8edf3;
}
#box-1:hover ~ #circle {
background-color: #e6cf8b;
box-shadow:inset 0em -0.3em 0.4em 0.2em #ca9e03a6;
}
#box-2 {
background-color: #e6cf8b;
}
#box-2:hover ~ #circle {
background-color: transparent;
border: 3px solid #E91E63;
}
#box-3 {
background-color: #b56969;
}
#box-3:hover ~ #circle {
height: 1em;
width: 1em;
background-color: #e6cf8b;
}
#box-4 {
background-color: #22264b;
color: white;
}
#box-4:hover ~ #circle {
background-image: linear-gradient(to top, #fbc2eb 0%, #a6c1ee 100%);
}
#circle {
position: fixed;
border-radius: 50%;
z-index: 5;
height: 32px;
width: 32px;
background-color: white;
}
<div id="wrapper">
<div id="box-1" class="box">Sphere</div>
<div id="box-2" class="box">Circle outline</div>
<div id="box-3" class="box">Circle pin</div>
<div id="box-4" class="box">Circle color gradient</div>
<div id="circle"></div>
</div>
That's because your mouse moves faster than the circle and you hover over it, so the styles that apply to it are the same ones than when the cursor is on the background green/blue-ish area of the page.
You can fix that by adding pointer-events: none to the circle so that it feels a bit like this:
Ok, where were we? Oh yes... So you should use position: fixed instead of absolute (as you really want your cursor to be positioned relative to the top-left corner of the viewport) and probably window.requestAnimationFrame to get a smoother animation and translate3d(0, 0, 0) to promote the element to its own layer and enable hardware-accelerated rendering, which will also contribute to make it feel smoother.
You could also hide the default cursor with cursor: none and center the circle where the arrowhead of the cursor is to make it feel just like a real cursor.
const circle = document.getElementById('circle');
const circleStyle = circle.style;
document.addEventListener('mousemove', e => {
window.requestAnimationFrame(() => {
circleStyle.top = `${ e.clientY - circle.offsetHeight/2 }px`;
circleStyle.left = `${ e.clientX - circle.offsetWidth/2 }px`;
});
});
body {
margin: 0;
height: 100vh;
background-color: #acd1d2;
position: relative;
display: flex;
justify-content: center;
align-items: center;
font-family: monospace;
cursor: none;
}
#wrapper {
position: relative;
width: 70%;
height: 80%;
}
#circle {
position: fixed;
border-radius: 50%;
z-index: 5;
height: 32px;
width: 32px;
background-color: white;
pointer-events: none;
transition:
background ease-in 10ms,
box-shadow ease-in 150ms,
transform ease-in 150ms;
/* Promote it to its own layer to enable hardware accelerated rendering: */
transform: translate3d(0, 0, 0);
}
.box {
height: 25%;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
}
#box-1 {
background-color: #e8edf3;
}
#box-1:hover ~ #circle {
background-color: #e6cf8b;
box-shadow: 0 0 0 0 transparent, inset 0em -0.3em 0.4em 0.2em #ca9e03a6;
}
#box-2 {
background-color: #e6cf8b;
}
#box-2:hover ~ #circle {
background-color: transparent;
/* Use box-shadow instead of border to avoid changing the dimensions of the
cursor, which will make it be off-center until the mouse moves again: */
aborder: 3px solid #E91E63;
box-shadow: 0 0 0 3px #E91E63;
}
#box-3 {
background-color: #b56969;
}
#box-3:hover ~ #circle {
background-color: #e6cf8b;
/* Change its size with scale() instead of width and height for better
performance performance: */
transform: scale(0.5) translate3d(0, 0, 0);
}
#box-4 {
background-color: #22264b;
color: white;
}
#box-4:hover ~ #circle {
background-image: linear-gradient(to top, #fbc2eb 0%, #a6c1ee 100%);
}
<div id="wrapper">
<div id="box-1" class="box">Sphere</div>
<div id="box-2" class="box">Circle outline</div>
<div id="box-3" class="box">Circle pin</div>
<div id="box-4" class="box">Circle color gradient</div>
<div id="circle"></div>
</div>
Here you can see another cool example I made of a custom cursor using CSS that resembles a torch: How to darken a CSS background image but keep area around cursor brighter.
Also, you can check out the cursor on my website, which is quite similar to what you have done as it has animations/transitions between its different shapes or states.
🚀 Check it out here: https://gmzcodes.com/.
👨‍💻 Check the code here: https://github.com/Danziger/gmzcodes

How do I make the -ms-thumb pseudo element register pointer events on underlying range input in two input overlay in IE?

I want to make a range input with two handles. I have made one overlaying two inputs with type range. I use the css property pointer events to disable the track from intercepting any click meant to hit the underlying thumb. This works fine in Chrome and in Firefox. Is does not seems to pickup any pointer events in IE 11 or Edge. How do I get the -ms-thumb pseudo element to pick up the pointer events?
I have prepared a code pen to illustrate the problem. https://codepen.io/RemkoBoschker/pen/jzLgXq
The same code is included below
#mixin thumb($input-height, $input-border-radius, $input-thumb-color) {
width: $input-height;
height: $input-height;
border: none;
pointer-events: auto;
border-radius: $input-border-radius;
background-color: $input-thumb-color;
cursor: pointer;
position: relative;
z-index: 1;
}
/* https://codepen.io/rendykstan/pen/VLqZGO8 */
#mixin range-slider(
$width,
$height,
$input-top,
$input-bg-color,
$input-thumb-color,
$float: none,
$input-height: 20px,
$input-border-radius: 14px,
$bubble-width: 100px
) {
position: relative;
width: $width;
margin-left: (100% - $width) / 2;
height: $height;
float: $float;
text-align: center;
input[type='range'] {
-webkit-appearance: none;
pointer-events: none;
height: $input-height;
padding: 0;
position: absolute;
left: 0;
top: $input-top;
height: $input-height;
width: 100%;
border-radius: $input-border-radius;
border: 1px solid grey;
background: none;
&:focus,
&:active {
outline: none;
}
&::-webkit-slider-thumb {
-webkit-appearance: none;
box-sizing: content-box;
#include thumb($input-height, $input-border-radius, $input-thumb-color);
}
&::-moz-range-thumb {
#include thumb($input-height, $input-border-radius, $input-thumb-color);
}
&::-ms-thumb {
#include thumb($input-height, $input-border-radius, $input-thumb-color);
}
&::-webkit-slider-runnable-track {
/* your track styles */
}
&::-moz-range-track {
-moz-appearance: none;
background: none;
}
&::-ms-track {
/* should come after -webkit- */
border-color: transparent;
color: transparent;
background: transparent;
/* again your track styles */
}
&::-ms-fill-upper {
background: transparent;
}
&::-ms-fill-lower {
background: transparent;
}
&::-ms-tooltip {
display: none;
}
}
}
.range-slider {
#include range-slider(80%, 54px, 30px, #f1efef, green, left, 20px, 14px, 80px);
}
<div class="range-slider">
<input type="range" step="1" min="0" max="10" value=5>
<input type="range" step="1" min="0" max="10" value="3">
</div>
I have also written a cross-browser version using js.
https://codepen.io/RemkoBoschker/pen/bvaQBw
I also posted a bug report with Microsoft
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/16592591/

Bootstrap alert and close button functionality without CSS

I would like the Bootstrap alert and close button functionality. I've included the JQuery and Bootstrap javascript file in my page head but don not want the CSS in it because it overrides a ton of styling.
Currently I've added these parts of the Bootstrap to my own css to make the alert and close button appear.
.alert {
padding: 8px;
margin-bottom: 20px;
border: 1px solid transparent;
border-radius: 4px
}
.alert h4 {
margin-top: 0;
color: inherit
}
.alert .alert-link {
font-weight: 700
}
.alert>p,
.alert>ul {
margin-bottom: 0
}
.alert>p+p {
margin-top: 5px
}
.alert-dismissable,
.alert-dismissible {
padding-right: 35px
}
.alert-dismissable .close,
.alert-dismissible .close {
position: relative;
top: -2px;
right: -21px;
color: inherit
}
.alert-info {
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1
}
.alert-info hr {
border-top-color: #a6e1ec
}
.alert-info .alert-link {
color: #245269
}
.alert-danger {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1
}
.alert-danger hr {
border-top-color: #e4b9c0
}
.alert-danger .alert-link {
color: #843534
}
#-webkit-keyframes progress-bar-stripes {
from {
background-position: 40px 0
}
to {
background-position: 0 0
}
}
#-o-keyframes progress-bar-stripes {
from {
background-position: 40px 0
}
to {
background-position: 0 0
}
}
#keyframes progress-bar-stripes {
from {
background-position: 40px 0
}
to {
background-position: 0 0
}
}
This CSS makes the alert work as expected. The below part is for the close button. It styling has changed a bit, but I seem to be missing a few lines of CSS. Can anyone tell me which onesm can't seem to find them.
button.close { -webkit-appearance:none;padding:0;cursor:pointer;background:0;border:0}
Target HTML:
<% if (message.length > 0) { %>
<div class="alert alert-info"><%= message %><button type="button" class="close" data-dismiss="alert">x</button></div>
<% } %>
HTML (added alert-dismissable class, changed x to ×):
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert">×</button>
Message
</div>
CSS (added basic styles for close class):
.close {
float: right;
font-size: 21px;
font-weight: bold;
line-height: 1;
color: #000;
text-shadow: 0 1px 0 #fff;
filter: alpha(opacity=20);
opacity: .2;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
filter: alpha(opacity=50);
opacity: .5;
}
CODEPEN EXAMPLE

Resources