To change or set a font style for certain text, the fontFamily CSS property needs to be changed. The fontFamily property sets or returns a list of font-family names for text in an element.
object.style.fontFamily = "font"
To change the font style by option dropdown: The font values can be passed in option tags using option value.
- Before selecting any option (Initial value – Times New Roman):
- After selecting an option in dropdown:
- After selecting another option in dropdown:
- How to change font color in dropdown navbar when collapsed in bootstrap ?
- How to change the font style of a text canvas using Fabric.js ?
- How to change a select's options based on another dropdown using React?
- How to style a dropdown using CSS?
- How to change dropdown menu when time is changed ?
- How to add multiple font files for the same font ?
- How to change the font of HTML5 Canvas using a button in Angular.js?
- How to change font-family of a text canvas using Fabric.js ?
- How to change the font-color of disabled input using CSS ?
- How to change the font size of a text canvas using Fabric.js ?
- How to change font-weight of a canvas-type text using Fabric.js ?
- How to remove the default arrow icon from a dropdown list?
- How to Add Image into Dropdown List for each items ?
- How to change font size depending on width of container?
- How to change font color of the active nav-item in Bootstrap ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.