Skip to main content

Banner image/Hero Image Tutorial with HTML and CSS

    In this video, we will be creating a banner/hero image using CSS. A banner or hero image is a large, full-width image that is typically placed at the top of a website or webpage and is used to visually represent the content or purpose of the page. We will be using CSS properties such as background-image and background-size to create the banner/hero image, as well as some basic layout techniques to ensure that it looks great on all devices. By the end of this tutorial, you will have a fully functional banner/hero image that you can use on your own website. So, if you want to learn how to create a banner/hero image using CSS, be sure to follow this tutorial till the end. 


index.html
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Tutorial 6</title>
        <link rel="stylesheet" href="css/tutorial6.css">
        <link href="https://fonts.googleapis.com/css?family=Shadows+Into+Light|Source+Sans+Pro" rel="stylesheet">
    </head>
    <body>
        <div class="img-container">
            <div class="inner-container">
                <h1>HERO IMAGE SAMPLE</h1>
                <h2>The Quick Brown Fox Jumps Over the Lazy Dog</h2>
                <a class="btn" href="#">CLICK HERE</a>
            </div>
        </div>
    </body>
</html>

tutorial6.css
*{
    margin: 0;
    height: 100%;
}

body{
    width: 100%;
}

.img-container{
    background-image: url(../image/image.jpg);
    height: 70%;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    position: relative;
}

.inner-container{
    text-align: center;
    position: absolute;
    width: 100%;
    color: white;
    height:auto;
    margin-top: 200px;
}

h1{
    font-size: 7em;
    font-family: "Shadows into Light", sans-serif;
}

h2{
    margin-top: -17px;
    font-family: "Source Sans Pro", sans-serif;
    font-size: 1.7em;
    text-align: center;
    font-weight: 400;
}

a{
    margin-top: 20px;
    font-size: 1.3em;
    font-family: "Source Sans Pro", sans-serif;
}

.btn{
    display: inline-block;
    width: 200px;
    font-weight: bold;
    padding: 10px;
    color: #fff;
    border: 4px solid #fff;
    text-align: center;
    outline: none;
    text-decoration: none;
    transition: background-color 0.2s ease-out, color 0.2s ease-out;
}

.btn:hover,.btn:active{
    background-color: #fff;
    color: #000;
    transition: background-color 0.3s ease-in, color 0.3s ease-in;
}

@media only screen and (max-width: 920px){
    .inner-container{
        margin-top: 100px;
    }
}

@media only screen and (max-width: 540px){
    .inner-container{
        margin-top: 150px;
    }
    h1{
        font-size: 5em;
    }
    h2{
        font-size: 1.4em;
    }
}

Watch full video here!

Comments

Popular posts from this blog

Auto Image Slider using CSS Only

     Are you ready to learn how to create an image slider using only CSS? Look no further! In this tutorial, we'll walk you through the step-by-step process of building a sleek and modern image slider using HTML and CSS. No JavaScript required! In this tutorial We'll cover setting up the HTML structure for the slider.       This will include creating the container element and styling the slider with CSS. You'll also learn how to add transitions and animations to create a smooth sliding effect. By the end of this tutorial, you'll have a fully functional image slider that you can use on your own website. Whether you're a beginner or an experienced developer, this tutorial has something for you. So let's get started creating your own image slider using CSS today! index.html <html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="css/style.css"...

Control Your Weights using this Javascript App - Simple BMI Calculator

       Embark on a coding journey that will demystify the intricacies of web development with our comprehensive tutorial, "Creating a BMI Calculator Using JavaScript." Whether you're a novice in the realm of programming or an enthusiast seeking to augment your JavaScript skills, this step-by-step guide promises to be an illuminating experience. To kick off our journey, we'll delve into the fundamental building blocks of web development—HTML, CSS, and JavaScript. This tutorial caters to individuals ranging from absolute beginners to those looking to fortify their existing skill set. By providing a holistic understanding of these essential languages, participants can lay a solid foundation for their future endeavors in the dynamic field of web development.      As we progress through the tutorial, we'll focus extensively on JavaScript, unraveling its intricacies in a manner accessible to beginners. The comprehensive nature of this tutorial makes it an id...

Display Battery Status using HTML, CSS and Javascript

     Hey everyone, welcome to Code Instinct! In this tutorial, we're going to show you how to create a battery status indicator using HTML, CSS and Javascript. This is a great Javascript project for beginners who want to learn how to use the Battery API Javascript and create a battery level indicator. We'll also be showing you how to add a battery charging animation and CSS battery shape to make it more visually appealing.Our tutorial will cover all the steps needed to create your own battery status indicator with ease. You'll learn how to use the Battery API Javascript to get the current battery level of your device, and display it using HTML and CSS.       We'll also be covering the different types of battery indicators you can use and how to customize them to fit your website design. You'll learn how to create a battery charging animation using Javascript and CSS to give your battery status indicator a more dynamic look.At Code Instinct, we're dedi...