CSS Positions Sticky & Fixed

 <!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>

   
    <button class="btn">Need Help?</button>

    <div class="card">

        <img class="card-img" src="https://source.unsplash.com/1600x1000/?burger" alt="">
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Est, nam.</p>

    </div>

    <div class="box">

        <h3 class="title">Book Now 😊& Get 10% OFF🎉.</h3>
        <p class="description">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Est, nam.</p>

    </div>


    <div class="card">

        <img class="card-img" src="https://source.unsplash.com/1600x1000/?burger" alt="">
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Est, nam.</p>

    </div>


    <div class="card">

        <img class="card-img" src="https://source.unsplash.com/1600x1000/?burger" alt="">
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Est, nam.</p>

    </div>

    <div class="card">

        <img class="card-img" src="https://source.unsplash.com/1600x1000/?burger" alt="">
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Est, nam.</p>

    </div>


    <div class="card">

        <img class="card-img" src="https://source.unsplash.com/1600x1000/?burger" alt="">
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Est, nam.</p>

    </div>


















   
</body>
</html>





// CSS FILE

.card{

    border: solid grey;
    border-width: 1px;
    width: 300px;
    margin: 20px auto;
    border-radius: 10px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    padding: 5px 5px;

}

.card-img{
    width: 100%;
    border-radius: 10px;

}

.btn{
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;  
    border: solid black;
    border-width: 1px;
    border-radius: 65px;
    background-color: rgb(233, 119, 119);
 
    padding: 14px 35px;

    color: aliceblue;
   
    position: fixed;
    bottom: 10px;
   




}
.box{
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    margin: 20px auto;
    width: 300px;
    border: solid grey;
    border-width: 1px;
    border-radius: 14px;
    padding: 8px;
    background: orangered;
    position: sticky;
    top: 0;
    color: white;



}

.title{
    font-size: 16px;


    margin-bottom: 6px;



}

.description{
    /margin: 0px 0px 12px 0px ;
    font-size: 12px;



}

Output :-






Comments

Popular posts from this blog

Array Mapping and Filters Assignment

Rolling Dice

Basics Of Java Script Till DOM Beggining