Vertical line composed of dots within a div element

I am trying to create a design with a parent div containing three main elements - a dotted line from the top of the div to the headline, the headline itself, and another dotted line from the middle to the bottom of the div.

My question is how can I make these dotted lines (which work as divs with backgrounds) fluid so that their height adjusts based on the screen height? Here is an example fiddle of what I have so far: http://jsfiddle.net/5wo01f1y/4/

This is a snippet of my code:

<section id="whatwedo">
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2">
                <div class="dots">&nbsp;</div>
                    <div class="heading"><span>We love</span> <h1>What we do</h1></div>
                    <p>Bakery & Sweets</p>  
                <div class="dots">&nbsp;</div>
                    <i class="fa fa-chevron-down btn-down"></i>
            </div>
        </div>          
    </div>
 </section>

Here is some of the CSS:

@import url(http://fonts.googleapis.com/css?family=Signika+Negative:300,400,600,700&subset=latin-ext);
@import url(http://fonts.googleapis.com/css?family=Merriweather:400italic,400,700,700italic&subset=latin-ext);

body {
    font-family:'Signika Negative', sans-serif;
    font-size:14px;
}

html, body {
    min-height:100%;
    height:100%;
}

#whatwedo .heading {
    display:inline-block;
    background:#da2027;
    }

#whatwedo .heading span {
    color:#fff;
    text-transform:uppercase;
    font-size:36px;
}

#whatwedo p {
    font-family:'Merriweather', sans-serif;
    color:#fff;
    font-size:1.7em;
}

#whatwedo{
    background-color:#da2027;
    margin-top:0;
    padding-top: 85px;
    padding-bottom: 30px;
    text-align:center;
    height:100%;
}

#whatwedo h1 {
    color: white;
    text-transform:uppercase;
    display:inline-block;
}

.btn-down {
    text-align:center;
    margin:0 auto;
    color:#fff;
}

.dots {
   height:100%;
   margin:0 auto;
    width:9px;
    overflow:hidden;
    background:url('http://s23.postimg.org/8wexsdl07/dot.png') repeat-x;
}

I'm wondering if there is a simpler hack to achieve this without using jquery. Any suggestions would be appreciated!

Answer №1

Check out this CSS code snippet for creating a top dot.

.heading span:before{
content: "\00a0 ";
background: transparent url("http://s23.postimg.org/8wexsdl07/dot.png") repeat-x scroll 0% 0%;
width:9px;
position: absolute;
top:0px;
left:49%
}

To create a bottom dot, add a class to the p tag like

<p class="dot1">Bakery & Sweets</p>
.

.dot1:before{
content: "\00a0 ";
background: transparent url("http://s23.postimg.org/8wexsdl07/dot.png") repeat-x scroll 0% 0%;
width:9px;
position: absolute;
bottom:0px;
left:49%
}

If you want to precisely align the middle of the dot, adjust the "left" property accordingly. For example, you can use left:calc(50% - 9px); to set the exact center after accounting for the width of the dot.

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

Using jQuery with an update panel

What is the reason that jQuery tools do not function properly within an UpdatePanel? I have created a jQuery calendar that works fine, but when placed inside an UpdatePanel it stops working. ...

Encountering an issue with JQuery when attempting to create a double dropdown SelectList. Upon submitting the POST request, the output received is always

Two dropdownlists have been created, where one acts as a filter for the other. When selecting a customer from the dropdown Customer, only a limited set of ClientUsers is displayed in the dropdown ClientUser. This functionality is achieved using a jQuery fu ...

The loading GIF in jQuery is malfunctioning when displayed simultaneously on multiple div elements

I am currently working on my Laravel dashboard's blade to showcase various statistics. These stats will be updated whenever the date picker is changed. Below is the code for my date picker: <div class="row"> <div class=&qu ...

What is the procedure for downloading a file within a brackets-shell application?

Currently, I am utilizing Brackets-shell to develop a desktop packaged application designed for both Windows and OSX. This application, which operates within the Brackets shell environment, has the capability to access dynamically generated Excel sheets an ...

What are some ways to customize the appearance of my ReactJS application while it's being viewed on Chrome on

I'm currently in the process of running my ReactJS app on a Panasonic Vierra Smart TV browser. After importing core-js and babel-polyfill, I managed to load the webpage but encountered an issue with the UI alignment. The styling does not display corre ...

Ways to expand the dimensions of the date range selector input field

Take a look at this image for the mobile viewHello, I am looking to expand the width of the date range selector text box.Click here to see the visual representation Here is the code snippet: <div class="row"> <div class="col-xs-12 col-md-6"& ...

What's the Hold-Up with IntersectionObserver in Brackets?

As a novice in the world of web development, I have been utilizing Brackets as my main tool. Recently, I've encountered a few hurdles specifically related to javascript. One issue I'm facing is trying to implement lazy loading on a div containing ...

Location of a Confirmation Box

When positioning the confirmBox on a page with lots of content using absolute inside relative positioning, I encountered an issue where the confirmBox was centered in the page but not in the center of the screen. Since the confirmBox can be opened through ...

construct three columns that are equal in height

Check out this simplified code snippet for creating three perfectly aligned columns: * { box-sizing: border-box; } /* Create three equal columns that float next to each other */ .column { float: left; width: 33.33%; padding: 10px; height: 300 ...

How can I access the Blockly Factory code using the appropriate HTML syntax?

Utilizing VSCode and Block Factory tool at [https://blockly-demo.appspot.com/static/demos/blockfactory/index.html]. This is my code snippet in index.html: <html> <head> ... body { background-color: #fff; font-family ...

Tips for transferring information from ng-view to the navbar on the index.html page using AngularJS

Recently, I embarked on a journey to learn the MEAN stack and decided to challenge myself by building an authentication page from scratch instead of using the out-of-the-box solution. My main struggle lies in updating texts on my navbar. Here's a snip ...

The content on the page is not visible when viewing on an Android device in

After spending a considerable amount of time browsing StackOverFlow for coding solutions, I have come across a problem that I can't seem to find an answer for. Yesterday, I made some changes to the media queries on my site in order to incorporate a dr ...

Utilize AJAX JQuery to Transmit POST Data

I am facing an issue with sending the selected item from a Bootstrap dropdown to my controller using the POST method. Unfortunately, I am encountering difficulties in getting it to work. Within the dropdown, I am fetching records from the database and dis ...

Transform the JavaScript object received from an AJAX request into HTML code

Here is an example of what the result (data) looks like: <tr> <td> Something... </td> </tr> <div id="paging">1, 2, 3... </div> This is using ajax to retrieve data. ... dataType: "html", success: function( ...

Why is it that code that appears identical in the same browser and same size can look different when one version is deployed on localhost and the other remotely?

I've been working on a Material-UI Table where I customized the headers and table styles. While testing it locally with yarn start, it looked like this: https://i.stack.imgur.com/7yU2H.png However, when I viewed it on the remote system, it appeared ...

Ways to eliminate padding on narrow screens with bootstrap 5.2 features

I have a container with a padding of 5 (p-5) applied to it. However, I am looking for a way to automatically remove the padding when the screen size is small, without adding more CSS rules. Is there a solution using only bootstrap classes? <div class= ...

Converting and displaying seconds as Years, Months, and Days in Angular using a custom pipe_DROP-REP

When I retrieve seconds (validity) through API calling, I want to display it in terms of Years, Months, and Days on the frontend. What is the best way to achieve this - using a custom Pipe or another method? I have already created a custom pipe, but I&apo ...

Utilizing HTML Canvas: Incorporating a background image along with base64 data for enhanced visual effect

I am currently working on some JavaScript tasks in Laserfiche forms where I need to save the base64 data of an image in a separate text area. This data is then fed back into the image to convert the canvas into an image that can be saved in the system. On ...

Utilizing jQuery to dynamically alter image src based on browser resize

I am working on a project where I have two images of different sizes - one for screens smaller than 759px and another for screens larger than 759px. My goal is to dynamically change the image source based on the window width. While I have successfully ach ...

Unique Soundcloud visualization using webglonDeletegist

After going through the SoundCloud documentation, I have been trying to figure out how to create a visualizer for SoundCloud tracks. The challenge is that in order to achieve this effectively, I need access to the source waveform. I suspect that direct acc ...