

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to set the font to be displayed in small capital letters with JavaScript?
<p style="">To set the font in small capital letters, use the<em> fontVariant</em> property.</p><h2>Example</h2><p style="">You can try to run the following code to set the font to be displayed in small capital letters with JavaScript −</p><p style=""><a href="http://tpcg.io/oPaqWp" rel="nofollow noopener noreferrer" target="_blank">Live Demo</a></p><pre class="prettyprint notranslate"><!DOCTYPE html> <html> <body> <h1>Heading 1</h1> <p id="myID"> This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text. </p> <button type="button" onclick="display()">Set Font Family and Font Variant</button> <script> function display() { document.getElementById("myID").style.fontFamily = "verdana,sans-serif"; document.getElementById("myID").style.fontVariant = "small-caps"; } </script> </body> </html></pre>
- Related Questions & Answers
- How to create a small font text using JavaScript?
- How to find capital letters with Regex in MySQL?
- How to set the boldness of the font with JavaScript?
- How to use small font in HTML?
- How to set the font family for text with JavaScript?
- How to set the font size of text with JavaScript?
- How to move all capital letters to the beginning of the string in JavaScript?
- How to input letters in capital letters in an edit box in Selenium with python?
- Move string capital letters to front maintaining the relative order - JavaScript
- How to change string to be displayed as a subscript using JavaScript?
- Shorthand property to set the font with CSS
- How to subset an R data frame based on small letters?
- Regex in Python to put spaces between words starting with capital letters
- Set the font style with CSS
- Set the font variant with CSS
Advertisements