How To Do Text Indentation Using CSS With Examples

admin_img Posted By Bajarangi soft , Posted On 30-10-2020

In CSS The text-indent property is used to specify the indentation of the first line of a text .So today we discuss how to do it.

How To Do Text Indentation Using CSS With Examples

Step 1:Create index.html file and implement as below code in it.
 

<p>In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind
    ever since. 'Whenever you feel like criticizing anyone,' he told me, 'just remember that all the people in
    this world haven't had the advantages that you've had.'</p>


Step 2:Implement CSS code as below to Text Indentation.
 

<style>
    body {
        background: #2e9ad0;
    }

    p {
        text-indent: 50px;
    }
</style>


Complete Code For Text Indentation  Using CSS.

 

<!DOCTYPE html>
<html>
<head>
    <title>How To Do Text Indentation Using CSS With Examples</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"/>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<style>
    body {
        background: #2e9ad0;
    }

    p {
        text-indent: 50px;
    }
</style>
<body>
<br/><br/>
<div class="container">
    <br><br><br>
    <div class="text-center">
        <h1 id="color" style="color: white;">Text Indentation Using CSS</h1>
    </div>
    <br>
    <div class="well">
        <p>In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind
            ever since. 'Whenever you feel like criticizing anyone,' he told me, 'just remember that all the people in
            this world haven't had the advantages that you've had.'</p>

    </div>
    <br>
</div>
</body>
</html>

Related Post