top of page
Writer's pictureWeb Coding

How to create a simple homepage

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

*{
 padding0;
 margin0;
 font-family'oswald, sans-serif';
}

#backgroundImage{
 min-height100vh;
 background-imageurl(images/mountain.jpg);
 background-repeatno-repeat;
 background-positioncenter;
 background-sizecover;
}

#blackOverlay{
 min-height100vh;
 background-colorrgba(0000.7);
}

nav{
 padding-top1vh;
 height5vh;
 text-alignend;
 margin-right3%;
}

nav a{
 text-decorationnone;
 colorwhite;
 margin-left1.5%;
 font-size2vh;
}

nav a:hover{
 border-bottom1px solid white;
}

#about{
 height88vh;
 displayflex;
 align-itemscenter;
 justify-contentcenter;
 flex-directioncolumn;
 colorwhite;
}

#sbout h1{
 font-size8vh;
}

#about p{
 font-size4vh;
}

#about button{
 margin-top0.5vh;
 backgroundlinear-gradient(to right#ed213a#93291e);
 font-size2.5vh;
 padding0.2vh 2vh;
 bordernone;
 outlinenone;
 border-radius38px;
}

#about button:hover{
 filterbrightness(75%);
 cursorpointer;
}

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

11 views

Comments


bottom of page