Computer >> Computer tutorials >  >> Programming >> HTML

How do we set the alignment according to surrounding elements in HTML?


Use the align attribute to set the alignment. You can try to run the following code to implement align attribute in HTML −

Note − The align attribute deprecated in HTML5. Use CSS instead.

Example

<!DOCTYPE html>
<html>
   <body>
      <p align="right">A right-aligned paragraph.</p>
      <p><b>Note:</b> The align attribute is not supported in HTML5. Use CSS instead.</p>
   </body>
</html>