Create vertical dividers using only CSS3 as a background styling technique

I am attempting to create a vertical splitter to use as the background of a custom slider (similar to the one found here ). Can anyone help with how I can achieve this? Here is what I have tried so far:

<div id="wrapper">
    <div id="dragger">
        <div class="rect"></div>
        <div class="arrow-down"></div>
    </div>
    <div id="slide-container"></div>
</div>
<br />
<span class="drag-caption active" id="hi-caption">Hi, bot</span>  <span class="drag-caption" id="keep-caption">Keep sliding...</span>  <span class="drag-caption" id="submit-caption">Submit</span>

Here is the corresponding CSS:

* {
    font-family: calibri
}
#dragger {
    width: 10px;
    padding: 5px 10px 5px 5px;
}
.rect {
    background-color: #ccc;
    height: 15px;
    width: 10px;
}
.arrow-down {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #ccc;
}
#wrapper {
    z-index: 55;
    width: 200px;
    padding: 0 10px;
}
#slide-container {
    background: #dedede;
    height:2px;
    border-radius: 1px;
    margin-top:-18px;
}
.drag-caption {
    padding-right: 20px;
    color: #d4d4d4;
    -webkit-transition: color 500ms ease;
    -moz-transition: color 500ms ease;
    -ms-transition: color 500ms ease;
    -o-transition: color 500ms ease;
    transition: color 500ms ease;
}
.drag-caption.active {
    color: black;
}
#submit-caption{
    font-weight: bold;
}

Additionally, you can view the code on jsfiddle. My goal is to have the separators aligned with the captions and positioned directly on the background bar.

Something like this:

---|---------|------------|
   |         |            |
  Hi bot  Keep sliding  Submit

Answer №1

I have inserted a div along with two span elements and arranged the separators on the range using CSS Positioning techniques.

View Demo

Check out Demo 2 (If the last one isn't necessary)

Explore Demo 3 (Tailored to your specific needs)

In this implementation, I utilized CSS Positioning to accurately position each separator on the range bar. Feel free to adjust the left and right values based on your preferences.

<div id="slide-container"></div>
<div class="separators"><span></span><span></span></div> <!-- Insert this after #slide-container -->

.separators {
    position: relative;
}

.separators > span:before,
.separators > span:after{
    content: "|";
    position: absolute;
    z-index: -1;
    color: #DEDEDE;
}

.separators > span:nth-of-type(1):before {
    left: 50px;
    top: -12px;
}

.separators > span:nth-of-type(1):after {
    left: 100px;
    top: -12px;
}

.separators > span:nth-of-type(2):before {
    left: 150px;
    top: -12px;
}

.separators > span:nth-of-type(2):after {
    left: 200px;
    top: -12px;
}

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

A design featuring two columns and a fixed footer

I'm struggling to make my 2-column layout display properly with a footer that sticks to the bottom of the page. Despite following all the usual advice, my columns keep expanding beyond their container div, which causes the footer to get pushed off the ...

Is it possible for a draggable position:absolute div to shrink once it reaches the edge of a position:relative div

I am facing an issue with draggable divs that have position:absolute set inside a position:relative parent div. The problem occurs when I drag the divs to the edge of the parent container, causing them to shrink in size. I need the draggable divs to mainta ...

Customizing the width of the JQuery $ui.progressbar by overriding its properties

After spending some time, I successfully overrode the function that controls the width of the progress bar element in the jQuery UI widget version 1.12.1 from September 14, 2016. Initially, I needed the progress bar to completely fill a column in a table. ...

How to Display an Element Using AngularJs

I'm facing an issue with angularjs where I am attempting to display an element by clicking a checkbox, but it isn't working. I suspect the problem lies in the ng-model, but I'm unsure why. Here is the HTML code in index.html: <body ...

How can I determine the days that have been selected based on the sum of their values?

I am working with a list of checkboxes that represent the days of the week, each associated with a specific numerical value. The values assigned to the weekdays are [1,2,4,8,16,32,64]. <label class="m-checkbox"> <input type="checkbox" name="s ...

"Explore the dropdown options on the Twitter Bootstrap menu by hovering your cursor

Is there a way to modify the code so that when hovering over a dropdown menu created with Twitter Bootstrap 3, the menu expands and users are able to click on the expanded links? The HTML code I came up with is as follows: <nav> ...

What is the best way to center two items within a border?

Here is the CSS code I wrote to center align my text with a bottom border: .arrow-down { width: 2rem; display: inline; position: absolute; top: -0.6rem; left: 50%; margin-left: -59px; background: $grey_200; z-index: 5; } .showless > se ...

Is there a way to position a ListItem (using React) in the lower left corner in this specific case?

import * as React from 'react'; import { styled, useTheme } from '@mui/material/styles'; import Box from '@mui/material/Box'; import MuiDrawer from '@mui/material/Drawer'; import MuiAppBar from '@mui/material/Ap ...

From dividing into three sections to splitting into two sections

Struggling to create a list of images and descriptions in sets of threes at larger widths, transitioning to twos at smaller widths? The breakdown is causing chaos. Need help achieving clean one-half columns. Appreciate any assistance! ...

Creative Text Container CSS Styling

Check out this website for the container I want to replicate: container This is the specific textbox: Here's how mine currently appears: I analyzed their css file and examined their html source code. I isolated the section of html and css related t ...

Perform a check on the state of the slideToggle using an if-else function and provide a report on the slideToggle state

http://jsfiddle.net/vmKVS/ I need some help understanding the functionality of slideToggle using a small example. After toggling for the first time, the options element changes color to green. However, I expected the menu element to turn red when I togg ...

Dynamic content alongside a stationary sidebar that adjusts in width

Attempting to create a switchable sidebar (toggling between short and long form) using bootstrap, multiple examples, and online resources. The width of the sidebar changes when toggled, and I want the content to appear next to it regardless of its length. ...

HTML and JQuery Image Slide Show

Help! I'm struggling with this image slider that's meant to showcase images fading in and out every 5 seconds. Being a beginner in coding, I could really use some assistance with getting it to work properly. Currently, I'm stuck on the firs ...

When rendering, HTML characters are not translated

My JavaScript code generates the following HTML structure: <div contenteditable="false" tabindex="0" class="ProseMirror"> <p> didn't project a significant increase</p> </div> When rendered in the browser, it shows the cha ...

Accessing CSS content from a bundle within the code of an ASP.NET MVC website

I have a website that utilizes bootstrap along with a customized bootstrap theme. The website is designed to send notification emails to its users upon certain actions being triggered. For these notification emails, I want the content to be in well-format ...

Is anyone interested in incorporating Bootstrap 4.1.2 into their project and utilizing the npm package manager for easy integration?

I am trying to integrate Bootstrap 4.1.2 into my project using npm as a package manager. Can someone assist with this? ** note: I prefer to have Bootstrap locally rather than using BootstrapCDN as shown below: <link rel="stylesheet" href="//maxcdn.boo ...

Controlling SVG elements within React

Just starting my programming journey and currently diving into building a surf app using React JS. For the landing page, I want to display location pins on an image of a coastline. These pins should be clickable, leading users to detailed information about ...

What is the best way to style the header of a table when scrolling in CSS?

Currently, I am facing an issue with applying the top CSS property to the thead element of a table while scrolling. I have attempted various methods but have been unsuccessful in achieving the desired outcome. Initially, I used the scroll event, however, ...

Getting the height of a group of classes using the style attribute

How can I retrieve the current height of 813px in jQuery from the "style" section? An example of F12 CSS is shown here: https://i.sstatic.net/4wFfR.jpg My attempt at achieving this is as follows: function HandleAccordionControlSizeChanges(isOpened) { ...

When it comes to @font-face, Chrome has no trouble detecting the font, but an issue

<style> @font-face { font-family : 'Avenir'; src : url("/fonts/Avenir999.otf"); } p.price a span { /*font-family : 'Avenir';*/ font-size : 45px; color: #889900; ...