HTML | DOM Style fontSize Property Last Updated : 08 Aug, 2022 Comments Improve Suggest changes Like Article Like Report The fontSize property is used to set or get the font size of characters in a word should appear. Syntax: It returns the fontSize property.object.style.fontSizeIt sets the fontSize Property.object.style.fontSize = "value|initial|inherit" Property Values: ValueDescriptionxx-small x-small small medium large x-large xx-largePredefine sizes of fontsmallerDecreases by one relative unit of the font-sizelargerIncreases by one relative unit of the font-sizelengthFont-size in length unit%% of the parent element's font sizeinitialSet default valueinheritInherit property from its parent value Return value: It returns the font size of the text of element. Example-1: Change font size into small. html <!DOCTYPE html> <html> <head> <title>DOM Style fontSize Property </title> </head> <body> <center> <p style="color: green; width: 100%; font-size: 30px; font-weight: bold;" id="Geek1"> GeeksForGeeks </p> <h2>DOM Style fontSize Property </h2> <br> <button type="button" onclick="myGeeks()"> Click to change </button> <script> function myGeeks() { // Change font size in to small. document.getElementById( "Geek1").style.fontSize = "small"; } </script> </center> </body> </html> Output: Before click on button: After click on button: Example-2: Change font-size into xx-large. html <!DOCTYPE html> <html> <head> <title>DOM Style fontSize Property </title> </head> <body> <center> <p style="color: green; width: 100%; font-size: 10px; font-weight: bold;" id="Geek1"> GeeksForGeeks </p> <h2>DOM Style fontSize Property </h2> <br> <button type="button" onclick="myGeeks()"> Click to change </button> <script> function myGeeks() { // change into xx-large. document.getElementById( "Geek1").style.fontSize = "xx-large"; } </script> </center> </body> </html> Output: Before click on button: After click on button: Example-3: Change font-size using length unit. html <!DOCTYPE html> <html> <head> <title>DOM Style fontSize Property </title> </head> <body> <center> <p style="color: green; width: 100%; font-size: 10px; font-weight: bold;" id="Geek1"> GeeksForGeeks </p> <h2>DOM Style fontSize Property </h2> <br> <button type="button" onclick="myGeeks()"> Click to change </button> <script> function myGeeks() { // Change font size from // from 10px to 30px document.getElementById( "Geek1").style.fontSize = "30px"; } </script> </center> </body> </html> Output: Before click on button: After click on button: Example-4: Change font-size using '%' html <!DOCTYPE html> <html> <head> <title>DOM Style fontSize Property </title> </head> <body> <center> <p style="color: green; width: 100%; font-size: 10px; font-weight: bold;" id="Geek1"> GeeksForGeeks </p> <h2>DOM Style fontSize Property </h2> <br> <button type="button" onclick="myGeeks()"> Click to change </button> <script> function myGeeks() { // Change font-size from 100% to 200% document.getElementById( "Geek1").style.fontSize = "200%"; } </script> </center> </body> </html> Output: Before click on button After click on button Supported Browsers: The browser supported by HTML | DOM Style fontSize Property are listed below: Google Chrome 1Edge 12Internet Explorer 5.5Mozilla firefox 1Opera 7Safari 1 Comment More infoAdvertise with us Next Article HTML | DOM Style paddingBottom Property P PranchalKatiyar Follow Improve Article Tags : Web Technologies HTML HTML-DOM HTML-Property Similar Reads HTML | DOM Style userSelect Property The DOM Style UserSelect Property is used to set or return whether the text can be selected by the user or not. Syntax: It is used to return the property: object.style.userSelectIt is used to set the property: object.style.userSelect = "auto|none|text|all" Properties : auto: It has the default value 2 min read HTML | DOM Title Object The Title Object in HTML DOM is used to represent the HTML <title> element. The <title> element can be accessed by using getElementByTagName() method. Syntax: document.getElementByTagName(); Properties: The title object contains single property text which is used to set or return a text 2 min read HTML DOM | Style paddingLeft Property The Style paddingLeft property is used for setting or returning the left padding of an element. The padding property inserts the user desired space within the border of an element.Syntax : To get the property: object.style.paddingLeftTo set the property: object.style.left = "auto|length|%|initial|in 2 min read HTML | DOM Style paddingBottom Property The Style paddingBottom property is used for setting or returning the bottom padding of an element. The padding property inserts the user desired space within the border of an element. Syntax: To get the property:object.style.paddingBottomTo set the property value:object.style.paddingBottom = "%|len 2 min read HTML DOM Style outlineOffset Property The Style outlineOffset property in HTML DOM is used to set or return the outline offset and draw it beyond the border edge. Outlines do not take space, unlike borders. It returns a string that represents the outline-offset property of an element. Syntax: Return the outlineOffset property.object.st 1 min read HTML | DOM Style paddingTop Property The Style paddingTop property is used for setting or returning the top padding of an element. The padding property inserts the user desired space within the border of an element. Syntax : To get the property:object.style.paddingTopTo set the property:object.style.paddingTop = "%|length|initial|inher 2 min read HTML DOM Style listStyleType Property The HTML DOM Style listStyleType property is used to set or return the list-item marker type. It has default values as "disc" for <ul> and "decimal" for <ol> and returns a string that represents the type of the list. SyntaxReturns the listStyleType property.object.style.listStyleTypeSet 2 min read HTML DOM Option Object The HTML DOM Option object represents an individual <option> element within a <select>, <datalist>, or <optgroup>. It allows JavaScript to access and manipulate the properties of options, such as setting the text, value, or whether an option is selected.Properties:disabled: T 2 min read HTML | DOM Style listStylePosition Property The DOM Style listStylePosition property sets or returns the position of the list-item marker. Syntax : For set the listStylePosition property:object.style.listStylePosition = valueFor return the listStylePosition property:object.style.listStylePosition Return Value: This return a String that repres 2 min read HTML | DOM Style fontFamily Property The fontFamily property set/return a list of Font-Family names and generic-family names for text in an element. The web browser will implement the first value it recognizes. Syntax: It returns the fontFamily property.object.style.fontFamilyIt sets the fontFamily Property.object.style.fontFamily = "f 2 min read Like