Text Alignment

HTML text alignment code is now deprecated. We have to use CSS for that.

  • Facebook
  • Twitter
  • LinkedIn
  • Instagram

Let's align the text on the red background to the centre. (On a side note, every programming language including HTML supports US English only. Don't use UK English.)

<!DOCTYPE html>

<html>

<head>

 

<style>

img.hero {

width:100%; height:auto

}

 

#Firstheading {

background-color: crimson;

color: white;

padding-bottom: 25px;

padding-top: 25px;

text-align: center;

}

</style>

</head>

<body>

<h1 ID="Firstheading">Mars Calling. Get Your Tickets Now!</h1>

 

<img class="hero" src="Images/Mars-Photo.jpg">

</body>

</html>

Screenshot_2021-10-12_11-43-07.png