Skip to content
- Courses
- DSA to Development
- Newly Launched!
- For Working Professionals
- For Students
- GATE Exam Courses
- All Courses
- Tutorials
- Data Structures & Algorithms
- DSA for Beginners
- Data Structures
- Algorithms
- Complete DSA Tutorial
- Competitive Programming
- Company Wise SDE Sheets
- DSA Cheat Sheets
- Top 100 DSA Interview Questions Topic-wise
- 100 Days of Code
- Python
- ML & Data Science
- Machine Learning
- Data Science Tutorial
- Data Science Packages
- Data Visualization
- Data Analysis
- Deep Learning
- NLP Tutorial
- OpenCV Tutorial
- Interview Questions
- System Design
- Interview Corner
- Languages
- Web Development
- HTML
- CSS
- JavaScript
- TypeScript
- ReactJS
- Node.js
- PHP
- AngularJS
- jQuery
- Web Development Using Python
- Web Design
- 100 Days of Web Development
- CS Subjects
- DevOps And Linux
- School Learning
- GATE
- GeeksforGeeks Videos
- Data Structures & Algorithms
- Jobs
- Practice
- All DSA Problems
- Problem of the Day
- Company Wise Coding Practice
- GfG SDE Sheet
- Practice Problems Difficulty Wise
- Language Wise Coding Practice
- Curated DSA Lists
- Contests
-
Last Updated : 12 Jan, 2024
Summarize
Comments
Improve
The HTML <hr> color Attribute is used to specify the color of a Horizontal rule. This attribute accepts color values in various formats, including color names, hexadecimal codes, or RGB values.
The ‘color’ attribute enables you to personalize the visual presentation of the horizontal rule, introducing a unique color tone to delineate different content sections.
Note: It is not supported by HTML5.
Syntax:
<Hr color= "color_name | hex_number | rgb_number">
Attribute Values:
Attribute Values
Description
color_name
It sets the Text color by using the color name. For example “red”.
hex_number
It sets the text color by using the color hex code. For example “#0000ff”.
rgb_number
It sets the text color by using the rgb code. For example: “RGB(0, 153, 0)”.
Example:The implementation of color attribute with <hr> tag
html
<!DOCTYPE html>
<
html
>
<
head
>
<
title
>
HTML hr color Attribute
</
title
>
</
head
>
<
body
style
=
"text-align:center;"
>
<
h1
style
=
"color: green;"
>
GeeksforGeeks
</
h1
>
<
h2
>
Hr color attribute
</
h2
>
See AlsoHow to Read Hex Color Codes - Hexadecimal ColorHTML font color Attribute - GeeksforGeeksW3Schools.comHTML Color Codes<
hr
width
=
"500px;"
color
=
"red"
size
=
"10"
>
<
p
>Computer science portal</
p
>
<
hr
width
=
"70%"
size
=
"20"
color
=
"blue"
noshade>
</
body
>
</
html
>
Output:
Example 2: The implementation of color attribute with <hr> tag
HTML
<!DOCTYPE html>
<
html
lang
=
"en"
>
<
head
>
<
meta
charset
=
"UTF-8"
>
<
meta
name
=
"viewport"
content
=
"width=device-width, initial-scale=1.0"
>
<
title
>GeeksforGeeks</
title
>
<
style
>
body {
text-align: center;
font-family: 'Arial', sans-serif;
background-color: #f4f4f4;
color: #424242;
margin: 0;
padding: 20px;
}
h2 {
margin-bottom: 20px;
}
hr {
border: 2px solid #e74c3c;
width: 50%;
margin: 20px auto;
}
</
style
>
</
head
>
<
body
>
<
h1
style
=
"color: #4CAF50;"
>
GeeksforGeeks
</
h1
>
<
h2
>HR Color Attribute Example</
h2
>
<
hr
>
<
p
style
=
"color: #555;"
>
Your go-to computer science
portal for knowledge and insights
</
p
>
<
hr
>
</
body
>
</
html
>
Output:
Supported Browsers
- Google Chrome 1
- Microsoft Edge 12
- Firefox 1
- Opera 12.1
- Safari 1
Please Login to comment...
Similar Reads
How to Change Background Color with Color Range Slider in HTML?
To Change the Background Color using an HTML rounded slider that dynamically changes the webpage's background as the slider thumb is moved along its track, giving a visual indication of the selected color. The approach provides a convenient method for customizing the visual appearance of the webpage in real-time. ApproachThe HTML document defines a
2 min read
How to Drop fill color to change the image color using HTML and CSS ?
In this article, we are going to create a Drop-fill color effect using HTML & CSS in which the image gets colored when we hover over it. It appears when you hover over the image a drop of color falls over the image which changes the color of the image from gray to colored. Approach: The following approach will be implemented to Drop fill color
4 min read
HTML | <basefont> color Attribute
The HTML <basefont> color Attribute is used to set the default font color in a document. Note: This attribute is not supported by HTML5. Syntax: <basefont color="color_name|hex_number|rgb_number"> Attribute Values: color_name It is used to specify the name of the font color. hex_number: It is used to specify the font color in terms of h
1 min read
HTML font color Attribute
The HTML font color attribute is used to specify the text color within the <font> tag. Although this method is deprecated in HTML5, it's still important to understand its historical use. Modern HTML uses CSS for styling purposes, but let's see how the font color attribute works. Syntax: <font color="color_name|hex_number|rgb_number">Att
3 min read
How href attribute is different from src attribute in HTML ?
In HTML5, the href and src attributes play distinct roles in defining paths or URLs, each associated with specific HTML elements. The href attribute, commonly found in an anchor (<a>) elements, points to the destination of hyperlinks, facilitating navigation. The src attribute, used with elements like <img> and <script>, specifies
1 min read
How to change text color depending on background color using JavaScript?
The task is to set the foreground color based on the background color so that it will become visible. Here few of the important techniques are discussed. We are going to use JavaScript. Approach: First, select the random Background color(by selecting random RGB values) or a specific one.Use the YIQ formula to get the YIQ value.Depending on the YIQ
3 min read
How to change an element color based on value of the color picker value using onclick?
We can define color picker by input type="color". It provides a user interface element that lets a user specify a color, either by using a visual color picker interface or by entering the color into a text field in #rrggbb hexadecimal format. Only colors without alpha channels are allowed. Though CSS colors have more formats, e.g. color names, func
2 min read
How to change an element color based on value of the color picker value on click?
The HTML tag <input type ="color"> provides a user interface element, that let the user specify the color with the help of the visual color picker interface or by entering the color value into the text field in #rrggbb hexadecimal format. Only simple colors (without alpha channel) are allowed though CSS colors has more formats, e.g. color nam
1 min read
How to convert 3-digit color code to 6-digit color code using JavaScript ?
In this article, we are converting a three-digit color HEX code into a six-digit color HEX code using JavaScript. To solve this problem, first, we copy the individual digits and paste them at the consecutive positions. For example - #34E will be converted into #3344EE and #E90 will be converted into #EE9900. Steps to convert 3-digit color code to 6
2 min read
Chakra UI Color and background color
Chakra UI, working smoothly with React, makes it easy to make your app look good. It's Color and background color helps you choose colors and backgrounds for your app in a way that's simple and makes sense. Chakra UI gives you a set of colors and backgrounds that are known to look good together. You can easily use these colors to make your text, bu
2 min read
How to choose background color through color picker?
In this project, we are going to change the background color with the help of the Color Picker. Glimpse of the Project: Approach: Create an HTML file in which we are going to add the text and a color picker which helps to change thebackground color of our web-page.Create a CSS style to give some animation effects to the web-page elements.Create a
3 min read
SVG flood-color Attribute
The flood-color attribute indicates what color is used to flood the current filter primitive subregion. Syntax: flood-color="color" Attribute Values: color: The color that we want to flood. We will use the flood-color attribute for setting the flood color. Example 1: <!DOCTYPE html> <html> <body> <svg viewBox="0 0 4000 200
1 min read
SVG stop-color Attribute
The stop-color attribute is used to indicate the color to be used at the stop point of a gradient. It only has an effect on the <stop> element. The default value of this attribute is "black". Syntax: stop-color = currentcolor | color | icccolor Attribute Values: This attribute accepts the values as mentioned above and described below: current
1 min read
SVG lighting-color Attribute
The lighting-color attribute represents the color of the light source for lighting filter primitives. The elements that using this attribute includes <feDiffuseLighting> and <feSpecularLighting> Syntax: lighting-color ="color" Attribute Values: The lighting-color attribute accepts the values mentioned above and described below color: It
1 min read
How to set background color of all divs in which attribute name ends with 'geeks' in jQuery ?
In this article, we will select all HTML div's with the value of name attribute ending with 'geeks' and used CSS background property to set the background color to green. Syntax: The following syntax can be used to get the above. $( "div[name$='geeks']" ).css( "background", "green" ); Approach : Create some tags with some names attribute value endi
2 min read
How to find all divs with a name attribute that contains word 'geeks' and sets the background color ?
jQuery contains attribute selectors with the help of which we can select the elements with name attribute as a particular string or select the elements which contain a particular string or begin with a particular string or ends with a particular string or don't contain a particular string as a name attribute. In this article, we will learn to find
4 min read
When to use the class attribute and the id attribute ?
The class attribute is used when multiple HTML elements share a common style or behaviour, allowing the application of a shared style to several elements. It promotes code reusability and is suitable for elements with similar characteristics. The id attribute is utilized when a unique identifier is needed for a specific HTML element. This identifie
1 min read
How to use the target attribute and the rel attribute in the <a> Tag ?
The target and rel attributes in the <a> (anchor) tag is used to control the behaviour of hyperlinks, specifying how the linked content should be opened and establishing relationships between the current and linked documents. Here's how to use these attributes: target Attribute:The target attribute determines where the linked content will be
2 min read
HTML | <html> xmlns Attribute
The HTML <html> xmlns Attribute is used to specify the xml namespace for a document. Important Note: This attribute is mainly required in XHTML, not valid in HTML 4.01, and optional in HTML 5. Syntax: <html xmlns="http://www.w3.org/1999/xhtml"> Attribute Values: https://www.geeksforgeeks.org/ It defines the namespace to use (for XHTML d
1 min read
HTML DOM Style color Property
The DOM style color property is used to set or return the color of the text. Syntax: It is used to set the color property.object.style.colorIt is used to return the color property.object.style.color = "color|initial|inherit" Return Values: It returns a string value that represents a text-color of an element. Example: In this example, we will use DO
1 min read
HTML | DOM Input Color Object
The Input Color Object property in HTML DOM is used to create and access the <input> element within the object. The <input> is used to enter data in the input field. Declaration of input control that allow user to input data is can be done by <input> elements are used within a <form>. Syntax: It is used to access the <inp
3 min read
HTML | DOM Input Color value Property
The DOM Input Color value Property in HTML DOM is used to set or return the value of the value attribute of a color picker. The value attribute is used to specify the color for the color picker. It's default value is #000000 (black color). Syntax It returns the value property.colorObject.valueIt is used to set the value property.colorObject.value =
2 min read
HTML DOM Input Color type Property
The DOM Input Color type Property in HTML DOM is used for returning which type of form element containing the color picker is. This property will always return "color". Syntax: colorObject.type Return Value: It returns a string value that represents the type of form element the input color field is. The below Program illustrates the use of the Inpu
1 min read
HTML DOM Input Color name Property
The DOM Input Color name Property in HTML DOM is used to set or return the value of the name attribute. The name attribute is required for each input color field. If the name attribute is not specified in an input field then the data of that field would not be sent at all. Syntax: It returns the Input Color name property.colorObject.nameIt is used
2 min read
HTML | DOM Input Color form Property
The DOM Input Color form Property in HTML DOM is used to return the reference to the form containing the input color picker field. It is read-only Property that returns a form object on success. Syntax: colorObject.form Return Values: It returns a string value which specify the reference of the form containing the Input Color field. The value of th
1 min read
HTML | DOM Input Color disabled Property
The DOM Input Color disabled Property in HTML DOM is used to set or return whether a color picker should be disabled or not. A Disabled element is usually is unusable and un-clickable and are usually grey in color by default in all the Browser. This Property is used to reflect the HTML disabled attribute. Syntax: It is used to return the disabled p
2 min read
HTML DOM Input Color defaultValue Property
The DOM Input Color defaultValue Property in HTML DOM is used to set or return the default value of a Color picker. It is the value specified in the value attribute. Syntax: It returns the defaultValue property.colorObject.defaultValueIt is used to set the defaultValue property.colorObject.defaultValue = value Property Values: value: It specifies t
2 min read
HTML | DOM Input Color autofocus Property
The DOM Input Color autofocus Property in HTML DOM is used to set or return whether the color picker should get automatically get focus or not when the page loads. This Property is used to reflect the HTML autofocus attribute. Syntax: It return the autofocus property.colorObject.autofocusIt is used to set the autofocus property.colorObject.autofocu
2 min read
HTML | DOM HR color Property
The DOM HR color property is used to set or return the value of the color attribute of a <hr> element. Note: This property is not supported by HTML5 Syntax: It returns a HR color property.hrobject.colorIt sets the HR color property.hrobject.color="value" Property Values: color_name: It holds the text color by using color name. For example: "r
2 min read
HTML | DOM Input Color autocomplete Property
The Input color autocomplete Property in HTML DOM is used to set or return the value of the autocomplete attribute of an Input color field. The autocomplete attribute is used to specify whether the autocomplete attribute has “on” or “off” value. When the autocomplete attribute is set to on, the browser will automatically complete the values based o
2 min read
Article Tags :
Trending in News
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
'); $('.spinner-loading-overlay').show(); jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id, check: true }), success:function(result) { jQuery.ajax({ url: writeApiUrl + 'suggestions/auth/' + `${post_id}/`, type: "GET", dataType: 'json', xhrFields: { withCredentials: true }, success: function (result) { $('.spinner-loading-overlay:eq(0)').remove(); var commentArray = result; if(commentArray === null || commentArray.length === 0) { // when no reason is availaible then user will redirected directly make the improvment. // call to api create-improvement-post $('body').append('
'); $('.spinner-loading-overlay').show(); jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id, }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.unlocked-status--improve-modal-content').css("display","none"); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); return; } var improvement_reason_html = ""; for(var comment of commentArray) { // loop creating improvement reason list markup var comment_id = comment['id']; var comment_text = comment['suggestion']; improvement_reason_html += `
${comment_text}
`; } $('.improvement-reasons_wrapper').html(improvement_reason_html); $('.improvement-bottom-btn').html("Create Improvement"); $('.improve-modal--improvement').hide(); $('.improvement-reason-modal').show(); }, error: function(e){ $('.spinner-loading-overlay:eq(0)').remove(); // stop loader when ajax failed; }, }); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); } else { if(loginData && !loginData.isLoggedIn) { $('.improve-modal--overlay').hide(); if ($('.header-main__wrapper').find('.header-main__signup.login-modal-btn').length) { $('.header-main__wrapper').find('.header-main__signup.login-modal-btn').click(); } return; } } }); $('.left-arrow-icon_wrapper').on('click',function(){ if($('.improve-modal--suggestion').is(":visible")) $('.improve-modal--suggestion').hide(); else{ $('.improvement-reason-modal').hide(); } $('.improve-modal--improvement').show(); }); function loadScript(src, callback) { var script = document.createElement('script'); script.src = src; script.onload = callback; document.head.appendChild(script); } function suggestionCall() { var suggest_val = $.trim($("#suggestion-section-textarea").val()); var array_String= suggest_val.split(" ") var gCaptchaToken = $("#g-recaptcha-response-suggestion-form").val(); var error_msg = false; if(suggest_val != "" && array_String.length >=4){ if(suggest_val.length <= 2000){ var payload = { "gfg_post_id" : `${post_id}`, "suggestion" : `
${suggest_val}
`, } if(!loginData || !loginData.isLoggedIn) // User is not logged in payload["g-recaptcha-token"] = gCaptchaToken jQuery.ajax({ type:'post', url: "https://apiwrite.geeksforgeeks.org/suggestions/auth/create/", xhrFields: { withCredentials: true }, crossDomain: true, contentType:'application/json', data: JSON.stringify(payload), success:function(data) { jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-section-textarea').val(""); jQuery('.suggest-bottom-btn').css("display","none"); // Update the modal content const modalSection = document.querySelector('.suggestion-modal-section'); modalSection.innerHTML = `
Thank You!
Your suggestions are valuable to us.
You can now also contribute to the GeeksforGeeks community by creating improvement and help your fellow geeks.
`; }, error:function(data) { jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Something went wrong."); jQuery('#suggestion-modal-alert').show(); error_msg = true; } }); } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Minimum 5 Words and Maximum Character limit is 2000."); jQuery('#suggestion-modal-alert').show(); jQuery('#suggestion-section-textarea').focus(); error_msg = true; } } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Enter atleast four words !"); jQuery('#suggestion-modal-alert').show(); jQuery('#suggestion-section-textarea').focus(); error_msg = true; } if(error_msg){ setTimeout(() => { jQuery('#suggestion-section-textarea').focus(); jQuery('#suggestion-modal-alert').hide(); }, 3000); } } document.querySelector('.suggest-bottom-btn').addEventListener('click', function(){ jQuery('body').append('
'); jQuery('.spinner-loading-overlay').show(); if(loginData && loginData.isLoggedIn) { suggestionCall(); return; } // load the captcha script and set the token loadScript('https://www.google.com/recaptcha/api.js?render=6LdMFNUZAAAAAIuRtzg0piOT-qXCbDF-iQiUi9KY',[], function() { setGoogleRecaptcha(); }); }); $('.improvement-bottom-btn.create-improvement-btn').click(function() { //create improvement button is clicked $('body').append('
'); $('.spinner-loading-overlay').show(); // send this option via create-improvement-post api jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.improvement-reason-modal').hide(); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); });