HTML Element Style How to - Align text right








Question

We would like to know how to align text right.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
input[type=text] {<!--from ww  w.  j  a  v a 2 s. c o m-->
  text-align: right
}
</style>
</head>
<body>
  <form>
    <input type="text" name="name" value="">
  </form>
</body>
</html>

The code above is rendered as follows: