HTML DOM HR width Property Last Updated : 29 Jan, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report The DOM HR width Property is used to set or return the value of the width attribute of an HR Element. Note: This property is not supported by HTML5. Syntax: It returns an HR width Property.hrObject.width; It sets the HR width Property.hrObject.width = "pixel | %";Property Values: Property Value Description pixel It specifies the width of the HR Element in terms of pixels. % It sets the width of <hr> attribute in terms of percentage (%). Return value: It returns a string value that represents the width of an HR Element. Example 1: This example returns the HR width property. HTML <!DOCTYPE html> <html> <head> <title>HTML DOM hr width property</title> </head> <body style="text-align: center;"> <h1>GeeksforGeeks</h1> <h2>HTML DOM HR width Property</h2> <p> Horizontal rule below this paragraph </p> <!-- Assigning id to 'hr' tag. --> <hr id="GFG" width="140px"> <button onclick="myGeeks()"> Click Here! </button> <p id="result"></p> <script> function myGeeks() { // Accessing 'hr' tag. let x = document.getElementById("GFG").width; document.getElementById("result").innerHTML = x; } </script> </body> </html> Output: Example 2: This example sets the HR width property. HTML <!DOCTYPE html> <html> <head> <title>HTML DOM hr width property</title> </head> <body style="text-align: center;"> <h1>GeeksforGeeks</h1> <h2>HTML DOM HR width Property</h2> <p> Horizontal rule below this paragraph </p> <!-- Assigning id to 'hr' tag. --> <hr id="GFG" width="140px"> <button onclick="myGeeks()"> Click Here! </button> <p id="result"></p> <script> function myGeeks() { let x = document.getElementById("GFG").width = "280px"; document.getElementById("result").innerHTML = "Value of width Attribute changed to " + x; } </script> </body> </html> Output: Supported Browsers: Chrome 1Edge 12Firefox 1Opera 12.1Safari 4 Comment More infoAdvertise with us Next Article HTML DOM Screen width Property M manaschhabra2 Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML | DOM HR size Property The DOM HR size property is used to set or return the value of the size attribute of the <hr> element. Note : This property is not supported by HTML5 Syntax: It returns the HR size property. hrobject.sizeIt is used to set the HR size property. hrobject.size="value" Property Values: value: It c 2 min read HTML | DOM Table width Property The Table width property in HTML DOM is used to set or return the value of the width attribute of a table. Note: This property is not supported by HTML5. Syntax: It returns the width property of a table.tableObject.width;It is used to set the width property of a table.tableObject.width ="pixels"; At 2 min read HTML DOM scrollWidth Property The DOM scrollWidth property is used to return the width of an element. This property includes padding and also content that is not visible on the screen due to overflow but does not include a border, scrollbar, or margin. It is a read-only property. Syntax: element.scrollWidth Return Value: It retu 1 min read HTML DOM Screen width Property The Screen width property is used for returning the total width of a user's screen. It returns the total width of the screen in pixels. Syntax: screen.widthReturn Value: A Number, representing the total width of the user's screen, in pixels Below program illustrates the Screen width Property : Check 1 min read HTML | DOM Object width Property The DOM Object width Property in HTML DOM is used to set or return the width of the Object. The width attribute is used to specify the width of an Object. Syntax: It returns the width property. objObject.widthIt is used to set the width property. objObject.width = pixels Property Values: It contains 2 min read HTML DOM Marquee width Property The HTML DOM Marquee width property is used to set or return the value of the width attribute of the <marquee> element. Syntax: It returns the marquee width property. marqueeObject.width; It sets the marquee width property. marqueeObject.width="px/%" Property values: px: It defines the width v 2 min read Like