Language

Input Type Text


Input Type="text" Controls writing plain text on one line in the input element.

It has been explained how to use the HTML input type text

Example

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form>
        <label for="fullName">Full Name</label>
        <input type="text" id="fullName">
        <input type="submit" value="Submit">
    </form>  
</body>
</html>
                

The writing direction can be changed based on the user. In this the user left-to-right or Can write right-to-left. The dir attribute is used to make such changes. The dir attribute is an enumerated attribute that has some values, such as: ltr, rtl, auto.


ltr: This value instructs the text to be written left-to-right.

rtl: This value instructs the text to be written from right to left.

auto: This value does not specify any direction, it acts as default.

Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title dir="rtl">Document</title>
</head>
<body>
    <form>
        <label for="fullName" >Full Name</label>
        <input type="text" id="fullName" dir="ltr"> <br><br>
        <label for="userMessage">Message</label>
        <input type="text" id="userMessage" dir="rtl"> <br><br>
        <input type="submit" value="Submit">
    </form>
</body>
</html>