Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to style up a hr tag

Tags:

html

css

styling

I would like to style up a <hr /> tag but can't seem to find an answer online anywhere that works.

I want to change the color and thickness if this is possible? I am able to change the length of it easy but that seems to be all that works so far.

Or is there an alternative to a hr tag that I can use?

Can anyone help me?

like image 229
Emma Avatar asked Nov 23 '15 12:11

Emma


People also ask

How do I change the visual appearance of my HR tags?

To make them look nicer, add CSS to adjust the visual appearance of these elements to be in line with how you want your site to look. A basic HR tag is displayed the way the browser wants to display it. Modern browsers typically display unstyled HR tags with a width of 100 percent, a height of 2 pixels, and a 3D border in black to create the line.

How to add color to the <hr> tag using CSS?

In this snippet, you can find some examples of adding color to the <hr> tag. Watch a video course CSS - The Complete Guide (incl. Flexbox, Grid & Sass) Use two <p> elements and add an <hr> element between them. Specify the height and background-color properties. Set the border to “none”. Let’s see the final code.

How to style an HR element with CSS?

Learn how to style an hr element with CSS. How To Style HR Horizontal Line You can use the borderproperty to style a hrelement: Example /* Red border */ hr.new1 { border-top: 1px solid red; /* Dashed red border */ hr.new2 { border-top: 1px dashed red; /* Dotted red border */ hr.new3 { border-top: 1px dotted red; /* Thick red border */ hr.new4 {

What is the use of the <hr> tag?

The <hr> tag defines a thematic break in an HTML page (e.g. a shift of topic). The <hr> element is used to separate content (or define a change) in an HTML page.


1 Answers

You can do this:

CSS

hr{
   border: none;
   height: 10px;
   background: #ccc;
}

DEMO HERE

like image 160
Luís P. A. Avatar answered Sep 18 '22 01:09

Luís P. A.