Home Html CSS Tutorial How to Create a Hero Image: HTML And CSS Only

How to Create a Hero Image: HTML And CSS Only

663
0
How to Create a Hero Image: HTML And CSS Only

Step by a step video tutorial to guide you on how to create a hero image with Html and CSS only.

Check the video out .

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="style.css">
    <title>How to Create a Hero Image HTML and CSS</title>
</head>
<body>
    <div class="hero-image">
        <div class="hero-text">
            <h1>I am  Sanusi Muhyideen </h1>
            <p>And I'm a front-End Developer </p>
            <p>Lagos Nigeria</p>
            <a href="#" class="hero-btn">Hire Me</a>
        </div>
    </div>
</body>
</html>   

CSS

body{
    margin: 0;
    padding: 0;
    height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
}

.hero-image{
    background-image: linear-gradient(
    rgba(0,0,0,0.5), 
    rgba(0,0,0, 0.5)), 
    url("img/bg.jpg");
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    height: 80%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-image .hero-text{
    color: #fff;
    text-align: center;
}

.hero-image .hero-text h1{
    font-size: 50px;
    font-weight: 500;
}

.hero-image .hero-text p{
    font-size: 30px;
    font-weight: 500;
    line-height: 10px;
}

.hero-image .hero-btn{
    text-decoration: none;
    color: #fff;
    background: #000;
    padding: 10px 30px;
    border-radius: 5px;
    margin-top: 10px;
    display: inline-block;
}

.hero-image .hero-btn:hover{
    background: #fff;
    color: #000;
}

Source Code

(Visited 183 times, 3 visits today)

LEAVE A REPLY

Please enter your comment!
Please enter your name here