Interactive Social Media Icons with Hover Effects



How can I apply HTML to create social media signs with display a hover effect?

Create an index.html file. Define the HTML document's boilerplate. Follow the html code below.

 HTML 

HTML code: The HTML code for this project is shown below. We will be using the icons from the font amazing, as I mentioned. The import code is located in the code's head section. Step-by-step follow the HTML code from top to bottom.


<!DOCTYPE html>

<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>PopUp Social Media Icons</title>
    <link rel="stylesheet" href="styles.css" />
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
      integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w=="
      crossorigin="anonymous"
    />
  </head>
  <body>
    <div class="wrapper">
      <div class="icon facebook">
        <div class="tooltip">Facebook</div>
        <span><i class="fab fa-facebook-f"></i></span>
      </div>
      <div class="icon twitter">
        <div class="tooltip">Twitter</div>
        <span><i class="fab fa-twitter"></i></span>
      </div>
      <div class="icon instagram">
        <div class="tooltip">Instagram</div>
        <span><i class="fab fa-instagram"></i></span>
      </div>
      <div class="icon github">
        <div class="tooltip">Github</div>
        <span><i class="fab fa-github"></i></span>
      </div>
      <div class="icon youtube">
        <div class="tooltip">Youtube</div>
        <span><i class="fab fa-youtube"></i></span>
      </div>
    </div>
  </body>

</html>

 CSS 

CSS code: Create a file named style.css. We have imported a custom font from Google Fonts, which will be required. Type the CSS code given below from top to bottom to observe the changes it makes.

@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

*:focus,
*:active {
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  display: grid;
  height: 100%;
  width: 100%;
  font-family: 'Poppins', sans-serif;
  place-items: center;
  background: linear-gradient(315deg, #ffffff, #d7e1ec);
}

.wrapper {
  display: inline-flex;
}

.wrapper .icon {
  position: relative;
  background-color: #ffffff;
  border-radius: 50%;
  padding: 15px;
  margin: 10px;
  width: 50px;
  height: 50px;
  font-size: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.wrapper .tooltip {
  position: absolute;
  top: 0;
  font-size: 14px;
  background-color: #ffffff;
  color: #ffffff;
  padding: 5px 8px;
  border-radius: 5px;
  box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.wrapper .icon:hover .tooltip {
  top: -45px;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;

}



<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>PopUp Social Media Icons</title> <link rel="stylesheet" href="styles.css" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" /> </head> <body> <div class="wrapper"> <div class="icon facebook"> <div class="tooltip">Facebook</div> <span><i class="fab fa-facebook-f"></i></span> </div> <div class="icon twitter"> <div class="tooltip">Twitter</div> <span><i class="fab fa-twitter"></i></span> </div> <div class="icon instagram"> <div class="tooltip">Instagram</div> <span><i class="fab fa-instagram"></i></span> </div> <div class="icon github"> <div class="tooltip">Github</div> <span><i class="fab fa-github"></i></span> </div> <div class="icon youtube"> <div class="tooltip">Youtube</div> <span><i class="fab fa-youtube"></i></span> </div> </div> </body> </html>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>PopUp Social Media Icons</title>
    <link rel="stylesheet" href="styles.css" />
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
      integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w=="
      crossorigin="anonymous"
    />
  </head>
  <body>
    <div class="wrapper">
      <div class="icon facebook">
        <div class="tooltip">Facebook</div>
        <span><i class="fab fa-facebook-f"></i></span>
      </div>

      <div class="icon twitter">
        <div class="tooltip">Twitter</div>
        <span><i class="fab fa-twitter"></i></span>
      </div>

      <div class="icon instagram">
        <div class="tooltip">Instagram</div>
        <span><i class="fab fa-instagram"></i></span>
      </div>

      <div class="icon github">
        <div class="tooltip">Github</div>
        <span><i class="fab fa-github"></i></span>
      </div>

      <div class="icon youtube">
        <div class="tooltip">Youtube</div>
        <span><i class="fab fa-youtube"></i></span>
      </div>
    </div>
  </body>  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>PopUp Social Media Icons</title>
    <link rel="stylesheet" href="styles.css" />
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
      integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w=="
      crossorigin="anonymous"
    />
  </head>
  <body>
    <div class="wrapper">
      <div class="icon facebook">
        <div class="tooltip">Facebook</div>
        <span><i class="fab fa-facebook-f"></i></span>
      </div>

      <div class="icon twitter">
        <div class="tooltip">Twitter</div>
        <span><i class="fab fa-twitter"></i></span>
      </div>

      <div class="icon instagram">
        <div class="tooltip">Instagram</div>
        <span><i class="fab fa-instagram"></i></span>
      </div>

      <div class="icon github">
        <div class="tooltip">Github</div>
        <span><i class="fab fa-github"></i></span>
      </div>

      <div class="icon youtube">
        <div class="tooltip">Youtube</div>
        <span><i class="fab fa-youtube"></i></span>
      </div>
    </div>
  </body>
</html>

Comments