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>

Updated on: 02-Mar-2020

557 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements