

- 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 indentation of the first line of text with JavaScript?
To set the indentation, use the textIndent property.
Example
You can try to run the following code to return the indentation of the first line of text with JavaScript −
<!DOCTYPE html> <html> <body> <div id = "myText"> This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. </div> <br> <button onclick = "display()">Set Text Indent</button> <script> function display() { document.getElementById("myText").style.textIndent = "50px"; } </script> </body> </html>
- Related Questions & Answers
- How to set the style of the line in a text decoration with JavaScript?
- How to set the type of line in a text-decoration with JavaScript?
- Set the height of a line of text with CSS
- How to set the color of the text-decoration with JavaScript?
- How to set the font size of text with JavaScript?
- How to set the horizontal alignment of text with JavaScript?
- How to set the decoration of a text with JavaScript?
- How to set the capitalization of a text with JavaScript?
- How to set the shadow effect of a text with JavaScript?
- Text Indentation Working with CSS
- How to set the text direction with JavaScript?
- Align the last line of the text with CSS
- How to return the color of the text with JavaScript?
- How to set the color of a text with CSS
- How to read only the first line of a file with Python?
Advertisements