The initial <hr> tag is the only one that is not currently displaying

While working on a page, I encountered an issue where a simple <hr> tag was not displaying. After some investigation, I noticed that if there are multiple <hr> tags on the page, only the first one would not show up while the others did. I have tried various combinations to resolve this problem without success. Even in my browser's developer tools, I couldn't find any discernible difference between the invisible and visible <hr> tags.

Here is an example of the code snippet:

        <div>
            <p>A</p>
            <hr>
            <p>B</p>
            <hr>
            <p>C</p>
        </div>

Only the line between B and C is visible.

Does anyone have any insight into what might be causing this issue?

For reference, I am using Bootstrap 4 and have not made any CSS alterations to the <hr> tag.

Edit:

I attempted to add some CSS to modify the border, resulting in the following output:

https://i.sstatic.net/yyoof.png

The upper line appears noticeably thinner. Below is the CSS used:

hr {
    border-top: 5px solid black;
}

Answer №1

Make sure to close your tags properly by adding the closing slash. Here's an example:

<section>
    <h2>Title</h2>
    <p>Content A</p>
    <br/>
    <p>Content B</p>
    <br/>
    <p>Content C</p>
</section>

Answer №2

Adjusting the height of the horizontal line allows you to specify a precise value, while still functioning correctly with borders.

hr{
    height: 3px;
    background-color: #000;
    border: none;
}
<div>   
   <p>A</p>
   <hr>
   <p>B</p>
   <hr>
   <p>C</p>
</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

Switch from using a select tag to a check box to easily switch between a dark and light theme

I have implemented a feature on my website that allows users to toggle between dark and light themes using the select tag with jQuery. Here is the code snippet that I am currently using: $(function() { // Code for changing stylesheets based on select ...

Responsive HTML code for a textarea, button, and table

I'm currently developing a website that includes a textarea, button, and table within the body content. The responsiveness of my content works well, except for extremely narrow displays such as mobile phones. In such cases, the table does not wrap pr ...

Repurpose the identical popup window

I am searching for a solution to use the same pop-up window whenever it is called. Currently, I need to submit a form into a pop-up window and it works well, except in Chrome iOS where each form submission opens a new tab/window instead of reusing the prev ...

Transforming nested JSON files into nested jQuery divs

Is it possible to iterate through two JSON files that have a parent-child relationship based on simple ID primary and foreign keys? Can we then display the data in a list of divs with the following characteristics: Hierarchical - child divs should only a ...

transfer chosen data from a text box to a dropdown menu

Looking for: I am in need of a feature where users can input a movie title in a textbox and upon clicking the "move to selectedlist" button, the entered movie title should be added to a dropdown list that displays all the movies selected by the user. Addit ...

Verify whether the value is in the negative range and implement CSS styling in React JS

I have been developing a ReactJS website where I utilize Axios to fetch prices from an API. After successfully implementing this feature, I am now looking for a way to visually indicate if the 24-hour change percentage is positive by showing it in green, a ...

AngularJs Pagination Feature: Display the Number of Items on Each Page

One challenge I am facing is how to display the number of items on each page. For instance, if I have 50 items for pagination with 10 items per page, I would like to indicate how many items are currently being displayed. For example, on the first page it ...

The navigation bar gets crowded by various elements on the page due to jQuery's sticky feature

Hey there! I'm currently working on a webpage and I must admit, I'm not the most experienced developer. I successfully created a sticky navbar using the jquery plugin sticky.js, which was great. However, I ran into an issue when I added animation ...

What are some strategies to stop text from causing the container height of the <li> element to expand?

Link to my code on Plunker In my attempt to create a fluid layout, the sidebar of my site consists of a list of links. I am trying to make each <li> element a perfect square, but when I add text inside, it disrupts the dimensions and turns the squar ...

SQL AJAX Query Form

I have been searching for tutorials on how to create a good form with PHP and AJAX. I tried starting with a code given to me by a friend and managed to send the request successfully. However, it seems like the data I receive is empty. Could you please take ...

Sidebar misalignment

Apologies in advance for what may seem like a trivial question, but I have been grappling with this all day and can't seem to find the solution. I've tried adding and removing divs without success. To make things easier, I've created two liv ...

Mouse click not functioning as anticipated

<ul> <li> <a href='javascript:;' class='close'>close</a> <a>openId</a> </li> </ul> My goal is to delete the li element when the close link (a.close) is clicked. The li elements are genera ...

Are there any alternative solutions to the onunload event in Chrome, or any other ways to achieve the

After extensive searching for a solution to this issue, including scouring Google Chrome support sites and the Chrome Bug Issues page where the problem has not yet been resolved. Currently, I find myself in a situation where I need to use the onload or onb ...

What is causing the lack of impact from comments on application.css.scss and application.js in Rails?

Recently, I've been experiencing a strange issue with the way application.js is utilized in Rails. My code looks like this: //= require jquery //= require jquery_ujs //= require turbolinks //= require bootstrap //= require_tree . //= require underscor ...

Building a Navigation Menu in Vue.JS Using Bootstrap Styles

Greetings! I had previously developed a Menu for my Vue 2 project. Upon creating a new Vue 2 project (with plans to migrate to Vue3), I proceeded to import my Menu, which consists of HTML and CSS. Unfortunately, it seems that the implementation is not wor ...

What is the best way to modify a date and time within an <td><input> element using jQuery?

I am looking to automate the updating of the datetime in a <td> tag, but I am struggling with implementing jQuery within tables. I also plan on resetting to the default datetime value if the checkbox is unchecked, although I will attempt to tackle t ...

Expand the element to accommodate the content, ensuring it does not surpass the boundaries of its parent

I am looking to create an element called .errorMessages that can grow to accommodate content (with a div set to overflow-y: auto to display a scrollbar), while still remaining within the boundaries of its parent container. The structure of the HTML is as ...

Issues with HTML5 video playback and jQuery script functionality on mobile devices are causing problems

Why Won't the Video Play on Mobile? The video in my slider plays perfectly on my PC, but when I tried to view it on my Galaxy Note 3 smartphone, it didn't work. The video should play automatically when the page loads or when the document is rea ...

Styling the body element in Material UI: A guide to customizing the

I'm having trouble figuring out how to target the root elements using the ThemeProvider in Material UI. const theme = createMuiTheme({ palette: { background: { default: "#00000", backgroundColor : 'black', b ...

Unable to watch video on android webview

I'm currently developing a mobile application for Android using PhoneGap, and I'm having trouble with playing HTML5 videos on my web page. The video is not visible and does not play automatically. How can I successfully play a HTML5 video on an A ...