HTML | DOM Style minWidth Property Last Updated : 08 Aug, 2022 Comments Improve Suggest changes Like Article Like Report The DOM Style minWidth Property is used to set or return the minimum width of an element. It works on block-level elements or on elements with absolute or fixed position only. Syntax: Return minWidth property:object.style.minWidthSet minWidth property:object.style.minWidth = "length|%|initial|inherit" Properties: length: It sets the minimum width in length units.%: It sets the minimum width in % of the parent.initial: It sets the property to the default value.inherit: It inherits the property values from the parent element. Return Value: It returns a string, representing the minimum width of the selected element. Example-1: html <!DOCTYPE html> <html> <head> <title> HTML | DOM Style minWidth Property </title> <style> h1 { color: green; } #gfgg { width: 60%; background-color: lightgreen; } </style> </head> <body> <center> <h1>GeeksforGeeks</h1> <button onclick="min()"> Press </button> <h4>Click on the 'Press' button to set the minWidth of the div element.</h4> <div id="gfgg"> <p>DOM Style minWidth Property: It is used to set the minWidth of an element.</p> <p>Here, the DIV element is used to showcase the min.width property.</p> <p>Clicking on the press button will execute the property.</p> </div> <script> function min() { document.getElementById( "gfgg").style.minWidth = "500px"; } </script> </center> </body> </html> Output: Before clicking on the button: After clicking on the button: Example-2: html <!DOCTYPE html> <html> <head> <title> HTML | DOM Style minWidth Property </title> <style> h1 { color: green; } #gfgg { width: 60%; background-color: lightgreen; } </style> </head> <body> <center> <h1>GeeksforGeeks</h1> <button onclick="min()">Press</button> <h4>Click on the 'Press' button to see the embedded box displaying the minWidth of the div element.</h4> <div style="background:lightgreen; min-width:200px;" id="gfgg"> <p>DOM Style minWidth Property: It is used to set the minWidth of an element.</p> <p>Here, the DIV element is used to showcase the min.width property.</p> <p>Clicking on the press button will execute the property.</p> </div> <script> function min() { alert(document.getElementById( "gfgg").style.minWidth); } </script> </center> </body> </html> Output: Before clicking on the button: After clicking on the button: Browser Support: The browsers supported by HTML DOM Style minWidth property are listed below: Google Chrome 1Edge 12Internet Explorer 7Firefox 1Opera 4Safari 1 Create Quiz Comment R riarawal99 Follow 0 Improve R riarawal99 Follow 0 Improve Article Tags : Web Technologies HTML HTML-DOM Explore HTML BasicsHTML Introduction4 min readHTML Editors4 min readHTML Basics7 min readStructure & ElementsHTML Elements4 min readHTML Attributes7 min readHTML Headings3 min readHTML Paragraphs3 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists3 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks2 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables9 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms5 min readHTML5 Semantics5 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List5 min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like