Issue
How can I put the h1 with the background to the center? I searched for it but I think because I'm too new at coding, I couldn't find where to find the mistake here.
.main-header, h1{
background-color: black;
color: white;
text-align:center;
position: relative;
background-size: 100px;
display: inline;
margin: auto
width: auto;
}
body{
background-color: purple;
margin: 0;
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Lei's Gym Wiki</title>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<div class="main-header">
<h1>Welcome To Leindras's Gym Wiki</h1>
</div>
</body>
</html>
Solution
All you need is text-align: center;
for the .main-header
. Probably you over loaded it with styles.
.main-header {
text-align: center;
}
h1 {
background-color: black;
color: white;
text-align: center;
position: relative;
background-size: 100px;
display: inline;
margin: auto;
width: auto;
}
body {
background-color: purple;
margin: 0;
}
<div class="main-header">
<h1>Welcome To Leindras's Gym Wiki</h1>
</div>
Answered By - IT goldman
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.