HTML Slider’s CSS not doing anything when I add custom HTML to a page
-
I’m using a slider for my page but the css is not affecting the slider.
Here is the HTML code:<h1>Random Brawlers Generator</h1> <div class="slidecontainerss"> <h3>Number of Brawlers to generate:</h3> <br> <input type="range" id="rangeInput" min="1" max="10" value="3" class="sliderss" oninput="numInput.value=rangeInput.value"> <input type="number" id="numInput" min="1" max="10" class="sliderValss" value="3" oninput="rangeInput.value=numInput.value"> </div> <label class="container">Allow repeated Brawlers <input type="checkbox" id="repeatBrawlers"> <span class="checkmark"></span> </label> <label class="container">Randomly generate Star Powers <input type="checkbox" id="randomStarPowers"> <span class="checkmark"></span> </label> <label class="container">Exclude Brawlers <input type="checkbox" id="excludeBrawlers"> <span class="checkmark"></span> </label> <button onclick="main()">Generate</button> <p id="gg">d</p> <img id="image" > <div class="groupContainer"> <div style="background-color:coral;" id="group1"> </div> <div style="background-color:lightblue;" id="group2"> </div> <div style="background-color:coral;" id="group3"> </div> <div style="background-color:lightblue;" id="group4"> </div> <div style="background-color:coral;" id="group5"> </div> <div style="background-color:lightblue;" id="group6"> </div> <div style="background-color:coral;" id="group7"> </div> <div style="background-color:lightblue;" id="group8"> </div> <div style="background-color:coral;" id="group9"> </div> <div style="background-color:lightblue;" id="group10"> </div> <div style="background-color:coral;" id="group11"> </div> <div style="background-color:lightblue;" id="group12"> </div> <div style="background-color:coral;" id="group13"> </div> <div style="background-color:lightblue;" id="group14"> </div> <div style="background-color:coral;" id="group15"> </div> <div style="background-color:lightblue;" id="group16"> </div> <div style="background-color:coral;" id="group17"> </div> <div style="background-color:lightblue;" id="group18"> </div> <div style="background-color:coral;" id="group19"> </div> <div style="background-color:lightblue;" id="group20"> </div> <div style="background-color:coral;" id="group21"> </div> <div style="background-color:lightblue;" id="group22"> </div> <div style="background-color:coral;" id="group23"> </div> <div style="background-color:lightblue;" id="group24"> </div> <div style="background-color:coral;" id="group25"> </div> <div style="background-color:lightblue;" id="group26"> </div> <div style="background-color:coral;" id="group27"> </div> <div style="background-color:lightblue;" id="group28"> </div> <div style="background-color:coral;" id="group29"> </div> <div style="background-color:lightblue;" id="group30"> </div> <div style="background-color:lightblue;" id="group31"> </div> <div style="background-color:lightblue;" id="group32"> </div> <div style="background-color:lightblue;" id="group33"> </div> </div>Here is the CSS:
.slidecontainer { width: 100%; border-radius: 50px; } .slider { -webkit-appearance: none; width: 200px; height: 15px; border-radius: 5px; background: #d3d3d3; outline: none; opacity: 0.7; -webkit-transition: .2s; transition: opacity .2s; } .slider:hover { opacity: 1; } .slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 25px; height: 25px; border-radius: 50%; background: #4CAF50; cursor: pointer; } .slider::-moz-range-thumb { width: 25px; height: 25px; border-radius: 50%; background: #4CAF50; cursor: pointer; } .container { display: block; width: 500px; position: relative; padding-left: 35px; margin-bottom: 12px; cursor: pointer; font-size: 22px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } /* Hide the browser's default checkbox */ .container input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; } /* Create a custom checkbox */ .checkmark { position: absolute; top: 0; left: 0; height: 25px; width: 25px; background-color: #eee; } /* On mouse-over, add a grey background color */ .container:hover input ~ .checkmark { background-color: #ccc; } /* When the checkbox is checked, add a blue background */ .container input:checked ~ .checkmark { background-color: #2196F3; } /* Create the checkmark/indicator (hidden when not checked) */ .checkmark:after { content: ""; position: absolute; display: none; } /* Show the checkmark when checked */ .container input:checked ~ .checkmark:after { display: block; } /* Style the checkmark/indicator */ .container .checkmark:after { left: 9px; top: 5px; width: 5px; height: 10px; border: solid white; border-width: 0 3px 3px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); } .sliderVal{ width: 70px; border-radius: 5px; border: solid grey; } .groupContainer{ width: 500px; height: 500px; border: 5px solid #c3c3c3; display: flex; flex-wrap: wrap; } .groupContainer div { width: 40px; height: 40px; margin-right: 20px; }The CSs works on other things just not on the slider. Thanks for any help!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘HTML Slider’s CSS not doing anything when I add custom HTML to a page’ is closed to new replies.