How To Change The Thickness Of Hr Tag Using CSS ? - GeeksforGeeks

Skip to content geeksforgeeks
  • Courses
    • DSA Courses
    • Programming Languages
  • Tutorials
    • Python Tutorial
      • Python Loops and Control Flow
    • Java
      • Java Interview Questions
      • Java Quiz
      • Advance Java
    • Programming Languages
    • System Design
    • Interview Corner
    • Computer Science Subjects
    • DevOps
    • Linux
    • Software Testing
    • Databases
    • Android
    • Excel
    • Mathematics
  • DSA
    • Data Structures
    • Algorithms
      • Analysis of Algorithms
      • Searching Algorithms
      • Sorting Algorithms
    • Practice
      • Company Wise Coding Practice
      • Practice Problems Difficulty Wise
      • Language Wise Coding Practice
      • Curated DSA Lists
    • Company Wise SDE Sheets
    • DSA Cheat Sheets
    • Puzzles
  • Data Science
    • Data Science Packages
    • Data Visualization
    • Data Analysis
  • Web Tech
    • Web Development Using Python
      • Django
      • Flask
    • Cheat Sheets
  • CSS Tutorial
  • CSS Exercises
  • CSS Interview Questions
  • CSS Selectors
  • CSS Properties
  • CSS Functions
  • CSS Examples
  • CSS Cheat Sheet
  • CSS Templates
  • CSS Frameworks
  • Bootstrap
  • Tailwind
  • CSS Formatter
Open In App How to change the thickness of hr tag using CSS ? Last Updated : 29 Oct, 2024 Summarize Comments Improve Suggest changes Like Article Like Save Share Report Follow

The <hr> tag in HTML creates a horizontal rule or a thematic break in an HTML page. The thickness of the <hr> tag defines the height of the horizontal line. To change the thickness of hr tag, CSS height property is used.

Syntax

hr { height: 3px;}

Example 1: Inserting a horizontal rule along with some CSS properties.

HTML <!DOCTYPE html> <html lang="en"> <head> <style> .custom-hr{ border:none; height:12px; background:black; margin:20px0; } </style> </head> <body> <h1>Code World</h1> <hr class="custom-hr" /> <h3>A Computer Science Portal</h3> </body> </html>

Output

Output

change the thickness of hr tag

Example 2: Different styling and thickness of <hr> element in CSS.

HTML <!DOCTYPE html> <html lang="en"> <head> <style> hr.class-1{ border-top:10pxsolid#8c8b8b; } hr.class-2{ border-top:3pxdouble#8c8b8b; } hr.class-3{ border-top:1pxdashed#8c8b8b; } hr.class-4{ border-top:1pxdotted#8c8b8b; } hr.class-5{ background-color:#fff; border-top:2pxdashed#8c8b8b; } hr.class-6{ background-color:#fff; border-top:5pxdotted#8c8b8b; } </style> </head> <body> <hr class="class-1" /> <hr class="class-2" /> <hr class="class-3" /> <hr class="class-4" /> <hr class="class-5" /> <hr class="class-6" /> </body> </html>

Output

Output

change the thickness of hr tag

P

Pankaj_Singh Follow Improve Next Article How to Change Font Size using CSS?

Similar Reads

CSS text-decoration-thickness Property In this article, we will discuss the text-decoration-thickness property in CSS. This property sets the width of the stroke of the decorated line below, above, or through the text. The different values that this option can take are as follows: auto: The thickness of the text-decoration line depends on the browser.font-file: Some font files include t 4 min read How to Set the Border Thickness of a Table in HTML ? To set the border thickness of a table in HTML, you use the "border" attribute within the <table> tag. This attribute specifies the width of the borders around the table and its cells. The value of the "border" attribute represents the thickness of the border in pixels (px). Syntax<table border="value"> <!-- Table content: rows and c 2 min read How to Vary the Thickness of Doughnut Chart in Chart.js ? Doughnut charts are widely used for representing data in a circular format that allows users to compare the proportions of different categories. We can use the cutout percentage property to accomplish this task. ChartJS CDN Link:To use Chart.js you have to include the CDN link in your HTML. <script src="https://cdn.jsdelivr.net/npm/chart.js"> 2 min read How to change the href value of a tag after click on button using JavaScript ? JavaScript is a high-level, interpreted, dynamically typed, and client-side scripting language. HTML is used to create static web pages. JavaScript enables interactive web pages when used along with HTML and CSS. Document Object Manipulation (DOM) is a programming interface for HTML and XML documents. DOM acts as an interface between JavaScript and 4 min read Which tag is used to represent progress of a task in HTML & how is it different from <meter> tag ? In this article, we will see which tag is used to represent the progress of a task in HTML. To represent the progress of a task, we will use the <progress> tag. This tag is used to represent the progress of a task. It is also defined how much work is done and how much is left. Syntax: <progress attributes...> </progress> Attribute 2 min read Why <big> tag is not in HTML5 while <small> tag exists ? The <big> tag was discontinued in HTML5 while <small> tag is still in handy because <small> tag is frequently used to represent small prints like footnotes, copyright notices, comments etc. Many alternatives for <big> tag are already available such as <h1>, <h2> and so on. In HTML5 instead of using <big>, y 2 min read Is container tag same as the empty tag in HTML? If not, why ? In this article, we will see the container tag & empty tag in HTML, along with knowing how they're different from each other. The Container tag is not the same as the empty tag & these are two different categories of tags used in HTML. Container tag: This tag contains 3 parts, namely, the opening tag, content that will be displayed in the b 5 min read Explain the difference between head Tag and header Tag in HTML5 ? The <head> element is a container for metadata and is placed between the <html> and <body> tags. The <header> is for the main content section's introductory elements, like headings or logos and it mainly focuses on what appears at the top of the webpage. <head> ElementThe <head> element is part of the HTML docume 1 min read What is the difference between the <br> Tag and the <p> Tag ? The <br> tag is used to insert a line break, creating a new line within text or content. It doesn't have a closing tag and is a self-closing tag. On the other hand, the <p> tag defines a paragraph, separating blocks of text. It has an opening <p> and a closing </p> tag, allowing for the structured organization of text into p 2 min read Difference between <article> tag and <section> tag Both the tags are semantics in HTML 5. In this article, we will discuss about the <article> and <section> tag. Both the <article> and <section> tags are represented similarly but used for some meaning, that meaning is for the browsers and the developers. Both tags can replace each other as there will be no changes to the out 4 min read What purpose does a <script> tag serve inside of a <noscript> tag? Usage of NoScript tag: The tag defines alternate content that will be displayed if the user has disabled script or browser does not support script. It can be used inside both <head> and <body> tag. Syntax: <noscript> Contents... </noscript> Example: [GFGTABS] HTML <html> <head> <title>wbr Tag</title> 1 min read How to Change the Style of <a> Tag Title Attribute ? The style of <a> (anchor) tag title attribute is pre-defined for the browser and it may differ from one browser to the other. The webpage cannot display the changes in the tool-tip if based on the title attribute. The option is to make a false-tool-tip using CSS properties according to the wish. For doing this, the data-title attribute must b 2 min read How to Change the Height of br Tag? The <br> (break) tag in HTML is used to create line breaks in text or content. By default, the <br> tag generates a simple line break without any additional spacing. Sometimes we need to adjust the height or spacing of the line break to control the layout. In this article, we will explore various methods to change the height of the < 2 min read How to remove CSS style of <style> tag using JavaScript/jQuery ? Given an HTML document containing inline and internal CSS and the task is to remove the style of <style> tag. The internal or embedded CSS is used within the head section of the HTML document. It is enclosed within <style> tag. Approach: The jQuery remove() and empty() methods are used to remove the CSS style of <style> element. E 2 min read How to Break Line Without using <br> Tag in HTML / CSS? Breaking lines in HTML without <br> tags can be achieved using block-level elements such as <div> or <p> combined with CSS properties like display: block; or display: inline-block; and others. These elements naturally wrap text or content, facilitating clean and structured layout design without manual line breaks. Below are the ap 2 min read How to wrap a text in a <pre> tag using CSS ? In this article, we will learn how to wrap a text in a <pre> tag. The <pre> tag is used to display the block of preformatted text which preserves the text spaces, line breaks, tabs, and other formatting characters which are ignored by web browsers. By default, the <pre> tag does not support the <pre> tag. In the case of rend 2 min read How to give a div tag 100% height of the browser window using CSS CSS allows to adjustment of the height of an element using the height property. While there are several units to specify the height of an element. Set the height of a <div> to 100% of its parent container with height: 100%, or use height: 100vh; for a full viewport height, ensuring the <div> spans the entire browser window. Adjust as pe 2 min read How to remove underline for anchors tag using CSS? The anchor tag (<a>) is used to define hyperlinks in HTML, Removing the underline from the anchor (<a>) tags in CSS involves setting the text-decoration property to none. This can be done by targeting the anchor elements with a CSS rule like a { text-decoration: none; }, which removes the default underline style from links. Default Hype 2 min read Display div element on hovering over <a> tag using CSS We will render the div element by hovering over the <a> tag using CSS. We can apply an adjacent sibling CSS selector property to the <a> tag that will display the hidden div element's content while hovering over it. The Adjacent sibling selector is a CSS Combinators, used to select the element that is adjacent or the element that is nex 2 min read How to change color of PNG image using CSS? Given an image and the task is to change the image color using CSS. Use filter function to change the png image color. Filter property is mainly used to set the visual effect to the image. There are many property value exist to the filter function. filter: none|blur()|brightness()|contrast()|drop-shadow()|grayscale() |hue-rotate()|invert()|opacity( 1 min read How to change Input characters to Upper Case while typing using CSS/jQuery ? Given an input text area and the task is to transform the lowercase characters into uppercase characters while taking input from user. It can be done using CSS or JavaScript. The first approach uses CSS transform property and the second approach uses JavaScript to convert the lowercase character to upper case character. Approach 1: This approach us 2 min read How to change the style of alert box using CSS ? An alert box is an important feature of JavaScript. It is used to inform the client or the user about the click events. Like if the user subscribes to your page for daily updates then you can wish them back, or thank them by showing an alert box message. Sometimes developers like us do not want to just show a normal text inside of the alert box we 4 min read How to change the color of selected text using CSS ? The colour of selected text can be easily changed by using the CSS | ::selection Selector. In the below code, we have used CSS ::selection on <h1> and <p> element and set its colour as yellow with green background. Below example implements the above approach: Example: <!DOCTYPE html> <html lang="en"> <head> 1 min read How to change the font-color of disabled input using CSS ? In this article, we are going to learn how to change the font-color of disabled input. There is a method to solve this problem, which is discussed below: Approach: With adding basic CSS property we are able to change the font-color of a disabled input. The disabled input element is unusable and un-clickable. This is a boolean attribute. Here using 2 min read How to Create an Effect to Change Button Color using HTML and CSS ? The color-changing effect of a button is very common but what we are going to do a slightly advanced version of this effect. The background will change like a clip effect rotating at some particular angle. Approach: The approach is to provide two or three background and then rotating them on different angles. HTML Code: In this section, we will use 3 min read How to change opacity of every data element on hover in a table using CSS ? There is a Table made by using HTML in which data elements are set to a low opacity. The task is to change the opacity of a particular element when user hover over data elements. To make a table look better, we will use gradient colors to set backgrounds of the table data elements. In this approach, we will be using the opacity property of CSS to c 2 min read How to change the cases of text in paragraph using CSS? The approach of this article is to how to change cases of text in a paragraph by using the CSS text-transform Property. It is s used to control the capitalization of the text. It mainly changes the text into upper case and lowercase format. Syntax: text-transform: none | capitalize | uppercase | lowercase | initial | inherit; Example: C/C++ Code 1 min read How to change/update CSS class dynamically using amp-bind in Google AMP ? Sometimes you want to add custom interactivity to your AMP pages to make your pages look more user-friendly and user calling. Although AMP's pre-built components are limited, so amp-bind is made to overcome this problem. It helps the developer to add custom interactivity to the pages without using AMP's pre-built components. You can use amp-bind to 3 min read How to change text selection color in the browsers using CSS ? Most of the browsers by default highlight the selected text in a blue background. This can be changed by using the ::selection pseudo selector in CSS. The ::selectionselector is used for setting the CSS property to the part of the document that is selected by the user (such as clicking and dragging the mouse across text). Only some CSS properties a 1 min read How to Change CSS Properties using JavaScript EventListner Methods ? In this article, we will be using JavaScript to update the web page's CSS styling by taking input from the user. Generally, we have seen a few webpages update the various styling properties dynamically by taking the user input that enhances the user interaction with the webpage, along with improving the overall user experience by engaging the users 3 min read Article Tags :
  • CSS
  • Web Technologies
  • CSS-Misc
Like three90RightbarBannerImg Explore More We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy Got It ! Lightbox Improvement Suggest changes Suggest Changes Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal. geeksforgeeks-suggest-icon Create Improvement Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all. geeksforgeeks-improvement-icon Suggest Changes min 4 words, max CharLimit:2000

What kind of Experience do you want to share?

Interview Experiences Admission Experiences Career Journeys Work Experiences Campus Experiences Competitive Exam Experiences

Từ khóa » Html Bold Line Hr