CSS Positions , absolute and relative

 <!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Document</title>
</head>
<body>

   

    <div class="india">

         

        <img class="india-img" src="https://source.unsplash.com/700x500/?india" alt="">

        <div class="bag"></div>

       
        <!-- this is for background image -->


        <div class="content">

            <h2 class="title">Explore India Book Now And Get 10% Off</h2>
            <p class="desc">Lorem ipsum dolor sit amet consectetur, adipisicing elit. Vero porro a animi quibusdam asperiores vel deleniti laboriosam sed aperiam distinctio?</p>
   
   
   
   
        </div>


    </div>
   
</body>
</html>

// CSS FILE

body{
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;

}

.india{
    width: 700px;
    margin: 130px auto;
    position: relative;

}

.content{
    position: absolute;
    bottom: 140px;
    left: 20px;
    color: white;

   
}

.india-img{
    border-radius: 10px;






}
.title{
    font-size: 32px;
    margin-bottom: 0px;





}

.desc{
   
    margin-top: 5   px;
    font-size: 16px;



}

.bag{
   
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.477);
    border-radius: 10px;


}

output :-



Comments

Popular posts from this blog

Array Mapping and Filters Assignment

Rolling Dice

Basics Of Java Script Till DOM Beggining