Click here to Skip to main content
15,891,874 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am currently learning HTML and CSS but I can't figure out how to center my text!

What I have tried:

Index

<!doctype html>
 <html>
  <head>
    <link href="style.css" rel="stylesheet" >
   <title> Test</title>
  </head>
  <body>
<h1> test </h1>
  </body>

</html>


Style sheet

h1 {
    font-family: Times;
    aling; Center;
    text-decoration: none;
    color: grey;
}
Posted
Updated 28-Dec-17 2:39am

1 solution

The problem is this line:
CSS
aling; Center;
It should be:
CSS
text-align: center; // or 'Center', casing doesn't matter
So there were three problems in your original line: a semicolon instead of a colon, aling instead of align, and you were missing the text- part.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900