Positioning custom elements over a slider using HTML and CSS

Trying to develop a custom slider that is compatible with Chrome and IE11, but encountering challenges in positioning the thumb and elements (white circle and red oval) on the slider track. The white circles need to be linked with a line.

If you want to see what I have achieved so far, check out this fiddle:

https://jsfiddle.net/Pravin_it14/7t9bsrdn/7/

/* Custom Slider Code */

.areaDetail_graph_04 {
  height: 87px;
  width: 614px!important;
  position: relative;


.range-labels li::before {
  content: "";
}

.input[type=range] {
  -webkit-appearance: none;
}

/* More CSS code here */
...
                                
<div class="areaDetail_graph_04">
  <div class="img">
    <div class="range">
      <input type="range" class="slider" width="614px" value="0" min="0" max="5" id="rangeSlider">
    </div>
    <ul class="range-labels">
      <li>11:00</li>
      <li>12:00</li>
      <li>13:00</li>
      <li>14:00</li>
      <li>15:00</li>
      <li>16:00</li>

    </ul>
    <span id="valBox"></span>
  </div>
</div>

Answer №1

Are you referring to the white circle being positioned behind the white line?

To address this, consider adding "margin-bottom: -15px;" to "input[type=range]::-webkit-slider-runnable-track";

Additionally, it is recommended to adjust the position of the circles inside li(5) and li (6).

Add "left: -20px;" in both "li:nth-child(5)" and "li:nth-child(6)".

The finalized code is provided below:

/*Slider*/

.areaDetail_graph_04 {
  height: 87px;
  width: 614px!important;
  position: relative;
}

...

<div class="areaDetail_graph_04">
  <div class="img">
    <div class="range">
      <input type="range" class="slider" width="614px" value="0" min="0" max="5" id="rangeSlider">
    </div>
    <ul class="range-labels">
      <li>11:00</li>
      <li>12:00</li>
      <li>13:00</li>
      <li>14:00</li>
      <li>15:00</li>
      <li>16:00</li>
    </ul>
    <span id="valBox"></span>
  </div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What causes the inconsistency between Chrome's print CSS emulation and the Print Preview feature?

My website is based on Bootstrap 3 and ensuring that certain pages print properly is crucial for our customers. While most of the site prints fine, we are having issues with modal dialogs. I have been experimenting with Chrome's (v42.0.2311.135 m) CS ...

What is the best way to create a drop-down menu that exports data directly to an Excel spreadsheet?

I have been struggling with a seemingly simple issue - I can't seem to get my drop-down box to display the chosen option. The code I'm using is quite similar to this generic one, but for some reason, it's not reporting the selected option to ...

Learn the method to conceal rows within a table simply by toggling a button

I need a function that will hide the rows below a row with a header and button, and only reveal them when another row with a header and button is clicked. When one of the +/- buttons is clicked, it should hide or expand all the rows with data content. http ...

jQuery - translating and organizing names of countries

I have implemented a jQuery function to organize a list of country names based on the user's selected language code (via a language select dropdown). You can find more information on this topic in this related post. The translation of country names s ...

Sharing details of html elements using ng-click (AngularJS)

I am currently exploring options to enable users to click on a "open in new tab" link, which would essentially transfer that HTML element into a fresh window for their convenience. I am seeking advice on how to achieve this. At the moment, I am able to la ...

The Bootstrap 4 navigation bar fails to be responsive and remains open despite attempts at styling

Having trouble with my navbar functionality... After applying CSS styling, it loses responsiveness and remains open on smaller screens. Here is the code snippet. HTML: <nav class="navbar navbar-expand-sm navbar-dark bg-dark" id="big-bar"> ...

Mysterious area located within a flexbox set to display items in a column arrangement

There is a mysterious gap within a flexbox that has a column direction. In the header-left div, I have set up a flexbox with a column direction. It consists of three nested divs: left_text_heading, hero-img, and hero-text. Strangely, there is an unknown s ...

Arrange dynamic elements in rows to utilize the entire available space, while ensuring that groups remain intact and are not split

My form allows users to dynamically add categories, groups, and individual inputs. I want to print the completed form so that it looks good on paper. The form can get quite complex, so I created a separate minimal page for printing purposes. You can view ...

Clicking again on the second onclick attribute

I have an image file named image1.png. When the button is clicked for the first time, I want it to change to image2.png. Then, when the button is clicked for a second time, I want it to change to yet another image, image3.png. So far, I've successful ...

Dynamic Label Editing on ASP Page Using Master Page

I am working on an ASP page with a Masterpage element on my website. The specific functionality I am trying to implement involves having multiple labels with an edit hyperlink next to each one. When the user clicks on the Edit hyperlink, I want the label t ...

Enable the Angular button only when the radio button has been selected

Just starting out with Angular and I have a query. This is a scenario for my project at work. https://i.stack.imgur.com/R3SxA.png In this screenshot, I want to enable the "ajouter" button when at least one radio button is selected in the secure chest (s ...

Retrieving data from a div container on an active website

Imagine having a website similar to , where you want to automatically retrieve the time value every second and save it in a .txt file. Initially, I considered using OCR (optical character recognition) software for this task, but soon realized that relying ...

Overlay causing z-index conflict

I am struggling to create an overlay effect that is not displaying correctly. .overlay { position: absolute; background-color: rgba(0, 0, 0, 0.6); z-index: -1; width: 100%; height: 100%; } .center-div { position: absolute; top: 50%; left ...

Difficulties with vertical scrolling on mobile devices due to the use of "-webkit-overflow-scrolling: touch"

In the midst of creating a new mobile website design that is responsive, an issue arose during testing on my phone. It seemed impossible to scroll vertically past a certain point if there was horizontal scrolling involved. To better illustrate this proble ...

When the browser width is reduced, the text appears outside of the image

When pasting text into an image in this example, everything looks fine at first. However, as the browser width is reduced, the text starts slipping out of the picture. To make matters worse, unsightly line breaks are also added. Is there a way to prevent ...

Refresh a partial view in Rails using AJAX with JSON feedback

Whenever I make a call to $.getJSON, my goal is to refresh the tbody elements. This means that I need to remove all current elements and replace them with new elements based on the JSON response. Javascript $(document).ready(function(){ $('#positi ...

Swap Text Inside String - JS

I have a challenge where I need to extract an ID from an HTML element and then replace part of the extracted word. For instance: HTML <input type="checkbox" id="facebookCheckbox"></div> JavaScript var x = document.getElementById("facebookCh ...

My live website is plagued by an annoying horizontal scroll bar that doesn't appear in the local host version

I am struggling to remove the unwanted horizontal scroll bar on my live website, although it is not visible on my local host... <-- this is my website, built using Vite + ReactJs. I attempted to use overflow: hidden; and max-width: 100% on the body t ...

Guide to locating the index of a div element that has been dropped onto a droppable div

My web application features drag and drop functionality allowing users to drag a div and dynamically drop it onto a droppable area. Additionally, the droppable area has sortable functionality enabled. Now, I need to determine the indexing in order to acc ...

Prevents side-to-side scrolling in the section while enabling scrolling up and down on the

I have a div on my website that allows for horizontal scrolling, while the entire page can be scrolled vertically. When the cursor is over a specific section, it disables vertical scrolling and enables horizontal scrolling within that section. I have imp ...