In this video, we will create an awesome text effect CSS only. This video on how to clip image on text using -webkit-background-clip. For a preview click on Demo If you want to get the complete source code in a zip file then click the "Fork me on GitHub" button below that will redirect you to my GitHub account where you found all my source code files. Copy Code(select code part and copy using "CTRL + C" or using R Click to mouse)🡇 HTML <! DOCTYPE html > < html lang = "en" > < head > < meta charset = "UTF-8" > < meta http-equiv = "X-UA-Compatible" content = "IE=edge" > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" > < title >How to clip image on text</ title > <!-- style.css --> < link rel = "stylesheet" href = "style.css" > </ head > < body >
In this video, we will create a custom range slider for a website with cross-browser compatibility using only HTML, CSS & JavaScript.
If you want to get the complete source code in a zip file then click the "Fork me on GitHub" button below that will redirect you to my GitHub account where you found all my source code files.
Copy Code(select code part and copy using "CTRL + C" or using R Click to mouse)🡇
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom Range Slider</title>
<!-- CSS -->
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="slider-container">
<span class="bar"><span class="fill"></span></span>
<input type="range" class="slider" id="slider" min="0" max="100" value="50">
</div>
</div>
<!-- JQuery & JavaScript -->
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="main.js"></script>
</body>
</html>
CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
outline: none;
border: none;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #422057;
}
.container {
width: 50vw;
}
.slider-container {
position: relative;
}
.slider-container .bar {
position: absolute;
z-index: 1;
top: 4px;
width: 100%;
height: 10px;
border-radius: 5px;
background-color: #fff;
overflow: hidden;
}
.slider-container .bar .fill {
display: block;
width: 0;
height: 100%;
background-color: #fcf951;
}
.slider-container .slider {
-webkit-appearance: none;
position: relative;
z-index: 2;
width: 100%;
height: 10px;
border-radius: 5px;
background-color: transparent;
}
.slider-container .slider::-webkit-slider-thumb {
-webkit-appearance: none;
width: 35px;
height: 35px;
background-color: #fcf951;
border-radius: 50%;
cursor: pointer;
transition: 0.3s;
}
.slider-container .slider::-webkit-slider-thumb:hover,
.slider-container .slider::-webkit-slider-thumb:active {
box-shadow: 0 0 0 20px #fcf95140;
}
/* for firefox browser */
.slider-container .slider::-moz-range-thumb {
-webkit-appearance: none;
width: 35px;
height: 35px;
background-color: #fcf951;
border-radius: 50%;
cursor: pointer;
transition: 0.3s;
border: none;
}
.slider-container .slider::-moz-range-thumb:hover,
.slider-container .slider::-moz-range-thumb:active {
box-shadow: 0 0 0 20px #fcf95140;
}
JavaScript
var $slider = $("#slider")
var $fill = $(".bar .fill")
function setBar() {
$fill.css("width", $slider.val() + "%")
}
$slider.on("input", setBar)
setBar()
Fork me on GitHub
Subscribe to me on YouTube
Like & Comment on my video on YouTube & press the bell icon to get notification first.
Follow me on Instagram
Comment down any query if you have.
Comments
Post a Comment
If you have any doubts please let me know.