top of page

How to create a simple homepage

Writer: Web Coding
Web Coding
Sep 6, 2020
1 min read

Today I will be teaching you how to create a simple homepage using only HTML and CSS


HTML

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <title>Document</title>
 <link rel="stylesheet" href="style.css">
 <link href="https://fonts.googleapis.com/css2?family=Oswald&display=swap" rel="stylesheet">
</head>
<body>
 <div id="backgroundImage">
 <div id="blackOverlay">
 <nav>
 <a href="">Home</a>
 <a href="">About</a>
 <a href="">Blog</a>
 <a href="">Contact</a>
 </nav>
 <div id="about">
 <h1>This is my new website</h1>
 <p>My website is all about ...</p>
 <button type="button">Click Me</button>
 </div>
 </div>
 </div>
</body>
</html>

CSS

*{
 padding: 0;
 margin: 0;
 font-family: 'oswald, sans-serif';
}

#backgroundImage{
 min-height: 100vh;
 background-image: url(images/mountain.jpg);
 background-repeat: no-repeat;
 background-position: center;
 background-size: cover;
}

#blackOverlay{
 min-height: 100vh;
 background-color: rgba(0, 0, 0, 0.7);
}

nav{
 padding-top: 1vh;
 height: 5vh;
 text-align: end;
 margin-right: 3%;
}

nav a{
 text-decoration: none;
 color: white;
 margin-left: 1.5%;
 font-size: 2vh;
}

nav a:hover{
 border-bottom: 1px solid white;
}

#about{
 height: 88vh;
 display: flex;
 align-items: center;
 justify-content: center;
 flex-direction: column;
 color: white;
}

#sbout h1{
 font-size: 8vh;
}

#about p{
 font-size: 4vh;
}

#about button{
 margin-top: 0.5vh;
 background: linear-gradient(to right, #ed213a, #93291e);
 font-size: 2.5vh;
 padding: 0.2vh 2vh;
 border: none;
 outline: none;
 border-radius: 38px;
}

#about button:hover{
 filter: brightness(75%);
 cursor: pointer;
}

If you found this blog post helpful don’t forget to check out my other projects and if you want more content follow me on


YouTube: https://www.youtube.com/channel/UC2nxqB2usQIS2c8zwVZKWEQ

Instagram: https://www.instagram.com/coding_for_the_web/

Twitter: https://twitter.com/LearnWebCoding

Comments


  • YouTube
  • Instagram

©2020 by Web Coding. Proudly created with Wix.com

bottom of page