- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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?
To set the font in small capital letters, use the fontVariant property.
Example
You can try to run the following code to set the font to be displayed in small capital letters with JavaScript −
<!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>
- Related Articles
- How to find capital letters with Regex in MySQL?
- How to set the boldness of the font with JavaScript?
- 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 create a small font text using JavaScript?
- How to input letters in capital letters in an edit box in Selenium with python?
- How to use small font in HTML?
- Move string capital letters to front maintaining the relative order - JavaScript
- How to change string to be displayed as a subscript using JavaScript?
- How to change string to be displayed as a superscript using JavaScript?
- Regex in Python to put spaces between words starting with capital letters
- How to set whether the style of the font is normal, italic or oblique with JavaScript?
- How to set font for text in JTextPane with Java?
- Shorthand property to set the font with CSS

Advertisements