How to create a horizontal line in CSS

0 votes

How to create a horizontal line in CSS?

I’m trying to add a horizontal line to my webpage using CSS for styling. What’s the best way to do this? Are there specific CSS properties I can use to customize its width, color, or style? Any tips for creating a line that fits well with the rest of the design would be appreciated

Oct 29, 2024 in Web Development by Nidhi
• 5,440 points
97 views

1 answer to this question.

0 votes

The most basic way to create a horizontal line in HTML is using <hr> tag. The <hr> tag adds a simple, horizontal line across the page, it is used to separate content sections.
you can style the <hr> tag to customize its look, like changing the color, width, or thickness in the CSS file later.

<hr class="styled-line">

.styled-line {
  border: 0;
  height: 2px;           
  background-color: #333; 
  width: 80%;             
  margin: 20px auto;     
}
answered Nov 4, 2024 by kavya

Related Questions In Web Development

0 votes
1 answer

How to create a node in a linked list?

A linked list is a linear data structure ...READ MORE

answered Nov 6, 2024 in Web Development by kavya
181 views
0 votes
1 answer

How to create a service file in Angular?

To create a service file in Angular, ...READ MORE

answered Nov 13, 2024 in Web Development by kavya
88 views
0 votes
1 answer

How to create an Observable from a string in Angular 2?

In Angular (or any JavaScript application using ...READ MORE

answered Nov 27, 2024 in Web Development by kavya
76 views
0 votes
1 answer

How to run a function in a script from the command line in Node.js?

To run a specific function within a ...READ MORE

answered Dec 13, 2024 in Web Development by Navya
66 views
0 votes
2 answers

Define a SQL query? What is the difference between SELECT and UPDATE Query? How do you use SQL in SAS?

HI.. SQL is Structured Query Language, which is ...READ MORE

answered Aug 8, 2020 in PHP by anonymous
10,713 views
0 votes
1 answer

Using/Handling colon inside a JSF generated HTML element ID in CSS selector

Yes, you can.  Just Backslash (\) the colon.  Like ...READ MORE

answered Nov 14, 2018 in Others by DataKing99
• 8,250 points
2,913 views
0 votes
1 answer

What is a css selector and where is it used?

CSS Selector is a combination of element ...READ MORE

answered Nov 21, 2018 in Data Analytics by Kalgi
• 52,350 points
989 views
0 votes
1 answer

What is the difference between span and div?

The div should be used to wrap sections of ...READ MORE

answered Jan 16, 2020 in Web Development by Niraj

edited Jan 21, 2020 by Niroj 3,760 views
0 votes
1 answer

How to update Angular version in a project?

Angular is a powerful framework for building ...READ MORE

answered Nov 4, 2024 in Web Development by kavya
159 views
0 votes
1 answer

How can you create a tag in Git?

Firstly, we should know what are tags ...READ MORE

answered Nov 4, 2024 in Web Development by kavya
103 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP