top of page

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>





img.hero {

width:100%; height:auto



#Firstheading {

background-color: crimson;

color: white;

padding-bottom: 25px;

padding-top: 25px;

text-align: center;





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


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



bottom of page