I searched all over the internet and couldn't find a solution to this problem. Therefore, I have decided to pose the question myself.
How can I center my text in HTML? I don't mean just aligning it centrally using "text-align:center;", but rather, how do I completely center it so that the text is perfectly placed in the middle of the webpage on a single line. Thank you in advance for your help.
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<title>AmazingWebsite.com | Explore Now!</title>
<link rel="stylesheet" type="text/css" href="websitecss.css">
</head>
<body>
<div class="container">
<div class="center">
<h1>Welcome to AmazingWebsite</h1>
</div>
</div>
</body>
</html>
CSS:
body {
background-image: url("amazingwebsitebg.jpg");
background-size: 100%;
}
h1 {
color:white;
text-align:center;
font-size:50px
}
.container {
}
.center {
}
Note: Although I have attempted to center the text within the center block, I am encountering difficulties achieving this.