Search code examples
jquerycsshtmljsp-tags

Attribute (align) is obsolete. Its use is discouraged in HTML5 documents


I'm getting the following error while using the align attribute. How can I resolve this error with the appropriate HTML5 compatible syntax?

<table  align="center">
            <tbody>
            <tr>
                <td><input type="text" name="username" placeholder="User Name" id="username" autocomplete="off"></td>
            </tr>
            <tr>
                <td><input type="password" name="password" placeholder="Password" id="password" autocomplete="off"></td>
            </tr>
            <tr>
                <td align="right">
                <input type="submit" class="btn btn-success" id="loginbutton" value="LOGIN" />
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                <input type="reset" class="btn btn-danger" id="resetbutton" value="RESET"/></td>
            </tr>
            </tbody>
        </table>

Solution

  • the align attribute is deprecated in HTML5 and you can use it in this way and it will work,

    <td style="text-align:right">