The horizontal rule element is not displaying

My <hr> element seems to be hidden.

This is the HTML code:

<div id="line"><hr /></div>

And this is the CSS code:

hr {
    border: 0;
    width: 96%;
    color: #FFFF00;
    height: 1px;
}


#line {
    float: left;
    width: 731px;
    height: 10px;
}

Can anyone figure out why it's not showing up?

Answer №1

Give this code a shot:

hr {
  border: 0;
  clear:both;
  display:block;
  width: 96%;               
  background-color:#FFFF00;
  height: 1px;
}

Check out the JSFiddle link http://jsfiddle.net/EXXrB/

Hopefully, this solution helps you tackle your issue.

Answer №2

Take out the border: 0; declaration from the styling rule related to hr

The Example

Answer №3

Easy Method for Creating a Stylish Horizontal Rule

.horizontalRule {  
    width: 100%; 
    height: 1px; 
    background-color: #e0e0e0;  
   }

Answer №4

hr
{
border:solid 1px black;
width: 96%;
color: #FFFF00;
height: 1px;

}

Answer №5

If you plan on using border:0px;, ensure that you also set height:1px; and background:#FF0000;
(OR)
border:1px solid #FF0000; and height:0px;

This should help resolve the issue!

You can either opt for a border color to display a horizontal line, or go with the background color for the <HR> tag

Answer №6

Give this a shot

hr {
border: 0;
clear:both;
display:block;
width: 96%;
color: #FFFF00;
height: 1px;
}

Answer №7

Give this a shot

line {
  length: 90%
  border-color: gray
}

Alternatively, for Tailwind CSS users

.line {
  @apply w-9/10 border-gray
}

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

Silhouette as the backdrop image

There is a span element that I am using in the following way - <span class="tick"></span> This creates a decorative "tick" for a checkbox. The CSS code used for this is - input[type="checkbox"] + span > span.tick { display: block; ...

Utilizing JavaScript to retrieve data from a self-submitting form

From my database, I am able to create a list of options for users to choose from. Once a selection is made, the values are submitted back to the same page and retrieved using Javascript. Within the same form, there are radio buttons and a multiple selecti ...

Utilize jQuery or Javascript in WinRT to transfer names between pages seamlessly

Is there a way to pass four names entered by the user on the first page to another page while navigating in a winRT app using winJS or jQuery? For example, if the four names are: 1. Akshay 2. Ashish 3. Pavitra 4. Adarsh How can this be achieved? ...

Splitting the page into four sections with a unique H layout using CSS styling

Attempting to create an H page layout: body { background-color: grey; background-size: 100%; background-repeat: no-repeat; } html, body { height: 100%; margin: 0px; } .a { float: left; width: 25%; height: 100%; border: 1px solid blue ...

Guide on aligning text along a baseline

CLICK HERE TO ENTER THE INTERACTIVE PLAYGROUND HTML: <div class="first">Text A</div> <div class="second">Text B</div> CSS: div { background-color: rgba(255, 0, 0, 0.3); /* For visualization only */ margin-top: 50px; ...

Issue with Bootstrap 5 Navbar menu link functionality after implementing 'data-bs-toggle' and 'data-bs-target' properties

I found a solution to the issue with the responsive menu not working as expected after following a post: Bootstrap close responsive menu "on click" When I click on the menu link, it fails to move to the intended section on the page. <link rel="styl ...

What could be causing the flexbox code to not take effect and the text to refuse wrapping?

I've been utilizing flexbox to style my content, and it worked seamlessly on the first three divs. However, when I attempted to apply the same styling to the fourth one, it didn't quite work out as planned. Despite trying options like flex-wrap t ...

Stripping CSS prefixes upon file initialization

When developing my application, I have a process in place where I load CSS files on the back-end using Express.JS and then transmit them to the front-end. However, before sending the CSS code to the front-end, I need to: Identify the user's browser; ...

Expanding the width of the textfield is not possible in CSS styling

My current search bar design features an input area that does not match my expectations. The input length is restricted and starts from the center rather than the black border I had envisioned. If you'd like to see the code and design in action, chec ...

What is the best way to create a Table with a Scroll feature and a fixed Header using CSS code, ensuring it looks sleek and functional across all devices, including smartphones?

I needed a CSS code for my Asp.Net Core Code that would apply to multiple tables. The desired style should include a fixed table header with a scrollable body, ensuring alignment between rows and columns. Despite trying various alternatives, I couldn' ...

Splitting an array into multiple arrays with distinct names: A step-by-step guide

I have a data set that looks like this: [A,1,0,1,0,1,B,1,0,0,1,A,1]. I want to divide this array into smaller arrays. Each division will occur at the positions where "A" or "B" is found in the original array. The new arrays should be named with the prefix ...

Displaying left and right div elements alongside each other in HTML/CSS works in Chrome, but not in Safari or Firefox

I've encountered an issue with aligning divs side by side in Firefox and Safari, although it seems to be working perfectly in Chrome. It's a bit tricky to provide all the CSS code as I have different stylesheets for mobile, normal, and print vers ...

Incorporate text inside the border of a Material UI chip

https://i.stack.imgur.com/VATrD.png I'm looking to replicate this design using a pre-built Chip component from MaterialUI While the solution might involve Some Text using html and css, it still may not achieve an identical result. I've come acr ...

A time-tracking counter that tallies the amount of time users spend on the webpage

I'm currently working on a code that tracks the time spent on a page starting from when it was clicked. My challenge now is figuring out how to capture the time when the submit button is clicked and store it in the database. < script > var ...

Guide to creating a dynamically filled dropdown menu with Angular 6 HTML

An array of employees is assigned tests by Lead. When assigning tests, the selected employee is properly assigned. When populating back, Lead can see which test is assigned to which employee. The issue I am facing is that EmployeeID is populated correctly ...

Incorporating RFID reader functionality into a website

I am currently facing an issue with integrating an RFID card reader into a web page. After some research, it seems that the solution involves creating an ActiveX component and using JavaScript. My question is, how can we go about building an ActiveX compo ...

What is the best method for storing a variety of HTML form data in a database?

I am currently working on developing a survey system that includes the feature of creating various types of questions through a drag & drop HTML form builder. The idea is for a client to create their survey form, which will then be stored in a database tab ...

Issue with Google Adsense - adsbygoogle.push() error: Pages can only support one AdSense head tag. The additional tag will be disregarded

After adding my script tag to the navbar component, I encountered an error on my site during the next js build: Google Adsense error -adsbygoogle.push() error: Only one AdSense head tag supported per page. The second tag is ignored <Head> ...

Create a visually appealing DataGrid cell by incorporating a vibrant colored oval with text or an icon inside

I'm in need of assistance with the mui/x-data-grid plugin. My goal is to display a cell within the grid containing both text and an icon, based on the value of the text. Unfortunately, I have been unable to achieve this so far. Here is the link to the ...

Position the label to the right and left of the input field for alignment

I've been struggling to create an input form with labeled using a dl, dt, dd list. I want the first label on the left, the second on the right, and the input in the center. However, no matter what I try, I can't get the second label to align corr ...