
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
How to set the shadow effect of a text with JavaScript?
To set the shadow effect, use the textShadow property in JavaScript.
Example
You can try to run the following code to return the shadow effect of a text with JavaScript −
<!DOCTYPE html> <html> <body> <button onclick = "display()">Set Text Shadow</button> <div id = "myID"> This is Demo Text! This is Demo Text! This is <br>This is Demo Text! This is Demo Text! This is Demo Text! This is Demo Text!<br> This is Demo Text!<br> This is Demo Text! This is Demo Text! This is Demo Text! This is Demo Text! </div> <script> function display() { document.getElementById("myID").style.textShadow = "2px 2px 2px #ff0000,20px 5px 2px #F1F1F1"; } </script> </body> </html>
- Related Articles
- Set the text shadow around a text with CSS
- Set Drop Shadow Effect with CSS
- How to add shadow Effect for a Text in Android?
- How to Apply Shadow Effect on Text Using CSS?
- How to set the decoration of a text with JavaScript?
- How to set the capitalization of a text with JavaScript?
- How to add a drop shadow effect to a text node in JavaFX?
- How to add an inner shadow effect to a text node in JavaFX?
- Add a blur effect to the shadow with CSS
- How to set the horizontal alignment of text with JavaScript?
- How to set the font size of text with JavaScript?
- How to set the color of the text-decoration with JavaScript?
- How to set when the transition effect will start with JavaScript?
- How to set the type of line in a text-decoration with JavaScript?
- Set the shadow around the text in CSS

Advertisements