Home > front end >  Bottom div is not centered because above div's are taking more space. How to get bottom div cen
Bottom div is not centered because above div's are taking more space. How to get bottom div cen

Time:01-16

the bottom "credit" div is not centered for some reason , plz give appropriate solution

https://codepen.io/rudrarocks71/pen/qBPgpNQ

body {
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradient 11s ease infinite;
    height: 100vh;
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

#title {
    color: #f5f6fa;
    padding: 32px;
    font-size: 40px;
    font-weight: bold;
    line-height: 1.25;
    display: block;
    font-family: sans-serif;
    width: 100%;
    text-align: center;
    text-decoration: none;
    justify-content: center;
}
#title:hover {
    transform: scale(1.4)
}

#links {
    max-width: 675px;
    width: auto;
    display: block;
    margin: 27px auto;
}

.link {
    position: relative;
    background-color: transparent;
    color: #f5f6fa;
    border: solid black 3px;
    border-radius: 16px;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    display: block;
    margin-right: 20%;
    margin-left: 20%;
    margin-bottom: 10px;
    padding: 12px;
    text-decoration: none;
}

.link:hover {
    background-color: #f5f6fa;
    color: #2f3640;
    transform: scale(1.05);
}

.link:active {
    background-color: rgb(4, 252, 66);
    color: #192a56;
}

i:hover {
    transform: scale(1.1);
}

#credit {
    position: relative;
    padding-top: 10px;
    padding-bottom: 10px;
    color: black;
    font-size: 1.5em;
    font-weight: 500;
    font-family: sans-serif;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>WHATSAPP-GROUP LINKS</title>
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>


<body>
    <div id="title">
        WHATSAPP-GROUP LINKS
    </div>
    <div id="buttons">
        <a  href="" target="_blank">
            <i >&nbsp;</i>whatsapp
        </a>
        <a  href="" target="_blank">

            <i ></i>whatsapp
        </a>
        <a  href="" target="_blank">
            <i >&nbsp;</i>whatsapp
        </a>
        <a  href="" target="_blank">
            <i >&nbsp;</i>whatsapp
        </a>
        <a  href="" target="_blank">
            <i >&nbsp;</i>whatsapp
        </a>
        <a  href="" target="_blank">
            <i >&nbsp;</i>whatsapp
        </a>
        <a  href=" target=" _blank ">
            <i >&nbsp;</i>whatsapp
        </a>
        <a  href=" " target="_blank ">
            <i >&nbsp;</i>whatsapp
        </a>
    </div>
    <div id="credit ">
        Made by Rudra Patole FY_B_22

    </div>
</body>

</html>

CodePudding user response:

You have a problem with your HTML. The id "credit " has a space after.

replace this:

  <div id="credit ">
        Made by Rudra Patole FY_B_22

  </div>

with this:

  <div id="credit">
  <!-- removed space after credit id (codepen take this like div.credit\)  -->
        Made by Rudra Patole FY_B_22

  </div>

CodePudding user response:

You can use flex in the credit selector:

display: flex;
justify-content: center;
  •  Tags:  
  • Related