HTML | DOM Style wordWrap Property Last Updated : 20 Oct, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report The Style wordWrap property in HTML DOM is used to set or return whether long words should be broken to wrap around to the next line. Syntax: To get the wordWrap property object.style.wordWrap To set the wordWrap property object.style.wordWrap = "normal|break-word|initial|inherit" Property Values: normal: This is used to break long words only at the break points. Return Values: It returns a string value, which representing the word-wrap property of an element Example-1: html <!DOCTYPE html> <html> <head> <title> DOM Style wordWrap Property </title> <style> .content { border: 1px solid; height: 200px; width: 200px; word-wrap: break-word; } </style> </head> <body> <h1 style="color: green"> GeeksforGeeks </h1> <b> DOM Style wordWrap Property </b> <p> The wordWrap property specifies whether long words should be broken to wrap around to the next line. </p> <div class="content"> GeeksforGeeksisacomputerscienceportal. </div> <button onclick="setWordWrap()"> Change wordWrap </button> <!-- Script to set wordWrap to normal --> <script> function setWordWrap() { elem = document.querySelector('.content'); elem.style.wordWrap = 'normal'; } </script> </body> </html> Output: Before clicking the button: After clicking the button: break-word: This is used to allow unbreakable words to be broken to the next line. Example-2: html <!DOCTYPE html> <html> <head> <title> DOM Style wordWrap Property </title> <style> .content { border: 1px solid; height: 200px; width: 200px; } </style> </head> <body> <h1 style="color: green"> GeeksforGeeks </h1> <b> DOM Style wordWrap Property </b> <p> The wordWrap property specifies whether long words should be broken to wrap around to the next line. </p> <div class="content"> GeeksforGeeksisacomputerscienceportal. </div> <button onclick="setWordWrap()"> Change wordWrap </button> <!-- Script to set wordWrap to break-word --> <script> function setWordWrap() { elem = document.querySelector('.content'); elem.style.wordWrap = 'break-word'; } </script> </body> </html> Output: Before clicking the button: After clicking the button: initial: This is used to set the property to its default value. Example-3: html highligt=38-39 <!DOCTYPE html> <html> <head> <title> DOM Style wordWrap Property </title> <style> .content { border: 1px solid; height: 200px; width: 200px; word-wrap: break-word; } </style> </head> <body> <h1 style="color: green"> GeeksforGeeks </h1> <b>DOM Style wordWrap Property</b> <p> The wordWrap property specifies whether long words should be broken to wrap around to the next line. </p> <div class="content"> GeeksforGeeksisacomputerscienceportal. </div> <button onclick="setWordWrap()"> Change wordWrap </button> <!-- Script to set wordWrap to initial --> <script> function setWordWrap() { elem = document.querySelector('.content'); elem.style.wordWrap = 'initial'; } </script> </body> </html> Output: Before clicking the button: After clicking the button: inherit: This is used to inherit the value from the parent of the element. Example-4: html <!DOCTYPE html> <html> <head> <title> DOM Style wordWrap Property </title> <style> #parent { word-wrap: break-word; } .content { border: 1px solid; height: 200px; width: 200px; word-wrap: normal; } </style> </head> <body> <h1 style="color: green"> GeeksforGeeks </h1> <b> DOM Style wordWrap Property </b> <p> The wordWrap property specifies whether long words should be broken to wrap around to the next line. </p> <div id="parent"> <div class="content"> GeeksforGeeksisacomputerscienceportal. </div> </div> <button onclick="setWordWrap()"> Change wordWrap </button> <!-- Script to set wordWrap to inherit --> <script> function setWordWrap() { elem = document.querySelector('.content'); elem.style.wordWrap = 'inherit'; } </script> </body> </html> Output: Before clicking the button: After clicking the button: Supported Browsers: The browser supported by DOM Style wordWrap Property are listed below: Google Chrome Firefox Internet Explorer Opera Safari Comment More infoAdvertise with us Next Article HTML | DOM Textarea wrap Property S sayantanm19 Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML | DOM Style wordBreak Property The DOM Style wordBreak Property is used to set or return the word-break property. The word-break property is used to specify how to break the word when the word is reached at the end of the line. The line breaks in the text can occur in a certain wordBreak property. Syntax: It is used to return the 2 min read HTML DOM Style wordSpacing Property The Style wordSpacing property in HTML DOM is used to set or return the spacing between the words. It can also be used to specify space between words. Syntax: It returns the wordSpacing property. object.style.wordSpacing It is used to set the wordSpacing property. object.style.wordSpacing = "normal 2 min read HTML | DOM Style whiteSpace Property The Style whiteSpace property in HTML DOM is used to set the whitespace for text content. It returns the whitespace property that is given to the text. Syntax: It returns the whiteSpace property. object.style.whiteSpaceIt is used to set the whiteSpace property. object.style.whiteSpace = "normal|nowr 2 min read HTML | DOM Textarea wrap Property The DOM Textarea wrap Property is used to set or return the value of the wrap attribute of the textarea. It describes the way the text to be wrapped while submitting a form. Syntax: It is used to return the wrap property.textareaObject.wrapIt is used to set the wrap property.textareaObject.wrap = so 2 min read HTML | DOM Style textOverflow Property The Style textOverflow property in HTML DOM is used to specify the behavior of the text when it overflows the containing element box. Syntax: It returns the textOverflow property.object.style.textOverflowIt is used to set the textOverflow property.object.style.textOverflow = "clip|ellipsis|initial|i 4 min read HTML DOM Style textDecoration Property The HTML DOM Style textDecoration property is used to set one or more decorations for a text. We can specify one or more text decorations for a text separated by spaces. It returns the textDecoration property that is given to the text. SyntaxIt returns the textDecoration property. object.style.textD 2 min read Like