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

Comment More info Next Article HTML | DOM Style tableLayout Property

P

Pankaj_Singh Follow Improve Article Tags :
  • CSS
  • Web Technologies
  • CSS-Misc

Similar Reads

  • Convert List of Characters to String in Java Given a list of characters. In this article, we will write a Java program to convert the given list to a string. Example of List-to-String ConversionInput : list = {'g', 'e', 'e', 'k', 's'} Output : "geeks" Input : list = {'a', 'b', 'c'} Output : "abc" Strings - Strings in Java are objects that are 4 min read
  • How to Convert Scala Map into JSON String? In this article, we will learn to convert a Scala Map into JSON String. We can convert Scala Map to JSON String using various libraries and custom conversion functions. Table of Content What is Scala Map?What is JSON String?Converting Scala Map into JSON StringWhat is Scala Map?In Scala, a Map is a 4 min read
  • How to read and write JSON files in Scala? Scala is frequently used for reading and writing JSON files in a variety of applications, particularly it includes data transmission. Table of Content Steps for reading JSON files in Scala:Steps for writing JSON files in Scala:Steps for reading JSON files in Scala:When reading JSON files in Scala we 3 min read
  • How to convert String to structtype in Scala? In Scala, whenever one deals with structured data such as JSON or CSV, there is usually a need to convert strings into structured data types like "StructType". This is very important for efficient processing and analysis of data, particularly in big data setups where Apache Spark is mostly used. To 3 min read
  • Convert a String to a List of Characters in Java In Java, to convert a string into a list of characters, we can use several methods depending on the requirements. In this article, we will learn how to convert a string to a list of characters in Java. Example: In this example, we will use the toCharArray() method to convert a String into a characte 3 min read
  • How to Escape Special Symbols in Scala String at Runtime? Handling special symbols' interior strings is an average project in Scala, especially whilst interacting with dynamically created cloth or consumer enter. If special symbols like quote marks, backslashes, or newline characters are not effectively escaped, they could bring about syntax errors or unex 3 min read
  • How to remove First and Last character from String in Scala? In this article, we will explore different approaches to removing the first and last character from a string in Scala. Table of Content Using substring methodUsing drop and dropRight methodsUsing substring methodIn this approach, we are using the substring method which takes two arguments the starti 1 min read
  • Split and Parse a string in Python In Python, working with strings is a fundamental aspect of programming. Strings are sequences of characters and often contain structured data that needs to be processed or analyzed. The common operations performed on strings are splitting and parsing. Splitting a String in PythonIn Python, you can s 5 min read
  • How to remove duplicate characters from a String in Scala? In this article, we will learn how to remove duplicate characters from a string in Scala using different approaches. First, we will look through the Brute-Force Approach and then use different standard libraries. Examples: Input: String = "hello"Output: helo Input: String = "Geeks"Output: Geks Naive 4 min read
  • JavaScript String substring() Method The substring() method in JavaScript is used to extract characters between two indices from a string, without modifying the original string. This method returns a new string that is a part of the original string, starting from a specified position up to (but not including) another specified position 5 min read
  • How to Create a JSON Object in Scala? JSON(JavaScript Object Notation) plays an important role in web development and data transmission. In web applications, we frequently use JSON, a lightweight data transmission standard. Working with JSON data is made easy using Scala, a sophisticated programming language for the Java Virtual Machine 2 min read
  • How to Escape Double Quotes in Scala? In this article, we will learn how to escape double quotes in Scala. Escaping double quotes means adding a special character or sequence before a double quote within a string to prevent it from being interpreted as the end of the string. Escape Double Quotes in ScalaBelow are the possible approaches 2 min read
  • How to reverse a String in Scala? In this article, we will learn to reverse a string in Scala. Reverse of a string means changing its order so that the last character becomes the first, the second-to-last becomes the second, and so on, effectively flipping the string's sequence of characters. Examples: Input: S = "GeeksforGeeks"Outp 3 min read
  • How to format numbers as percentages in Scala? In this article, we will learn to format numbers as percentages in Scala using various methods such as f, %, and java.text.DecimalFormat. Formatting numbers as percentages that consist of representing numerical values as ratios out of 100, typically with a specific number of decimal places. Example 2 min read
  • How to Remove Double Quotes from String in Scala? This article focuses on discussing how to remove double quotes from a string in Scala. Removing double quotes consists of eliminating all occurrences of double quotes (") from a given string, resulting in a modified string without the double quotes. Remove Double Quotes from String in ScalaBelow are 2 min read
  • strings.SplitN() Function in Golang with Examples strings.SplitN() Function() is a string manipulation function in Go language. It is used to split a given string into substrings separated by a separator. This function returns the slices of all substrings between those separators. Syntax: func SplitN(s, sep string, n int) []string Here, s is the st 3 min read
  • How to add new line Scala? In this article, we will learn how to add a new line in Scala. 1. Using the newline character (\n):This is the most straightforward approach. The \n character represents a newline and will be interpreted as such when the string is printed. [GFGTABS] Scala // Creating object object GfG { // Main meth 2 min read
  • Scala | String Interpolation String Interpolation refers to substitution of defined variables or expressions in a given String with respected values. String Interpolation provides an easy way to process String literals. To apply this feature of Scala, we must follow few rules: String must be defined with starting character as s 3 min read
  • strings.Fields() Function in Golang With Examples strings.Fields() Function in Golang is used to splits the given string around each instance of one or more consecutive white space characters, as defined by unicode.IsSpace, returning a slice of substrings of str or an empty slice if str contains only white space. Syntax: func Fields(str string) []s 2 min read
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