Hello folks, ready for another interesting design? Here it is; today in this blog you'll learn to create a very simple but a pleasant design of social media icons. So, what's special in it? as you are seeing in the image that every icon contains a tooltip which is created on hovering cursor over the icon. This tooltip contains the name of the platform.
It is important to note that these icons won't redirect you to any url. If you want to put any link then you'll have to introduce <a href="url of another page"> tag just before the <i class="fab fa-facebook-f"></i> and other same tags.
You might like these:
Preview of project:
Source code of design
So let's proceed toward's it's implementation. 😀
For your ease I have provided the download button in the end of this tutorial using which you may download all the required files of source code.
To create this design fist of all you'll need to create to files namely index.html and style.css. Make sure that you have used the correct extensions i.e. .html and .css.
Now all you need to do is copy the below code into index.html file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | <!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <title>CodePen - Social Media Icons with Popups (HTML + Pure CSS Only)</title> <meta name="viewport" content="width=device-width, initial-scale=1"><link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css'><link rel="stylesheet" href="./style.css"> </head> <body> <!-- partial:index.partial.html --> <ul class="wrapper"> <li class="icon facebook"> <span class="tooltip">Facebook</span> <span><i class="fab fa-facebook-f"></i></span> </li> <li class="icon twitter"> <span class="tooltip">Twitter</span> <span><i class="fab fa-twitter"></i></span> </li> <li class="icon instagram"> <span class="tooltip">Instagram</span> <span><i class="fab fa-instagram"></i></span> </li> <li class="icon github"> <span class="tooltip">Github</span> <span><i class="fab fa-github"></i></span> </li> <li class="icon youtube"> <span class="tooltip">Youtube</span> <span><i class="fab fa-youtube"></i></span> </li> </ul> <!-- partial --> <script src="./script.js"></script> </body> </html> |
Then copy and paste the below code into style.css file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | @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; list-style: none; } .wrapper .icon { position: relative; background: #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: #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 .tooltip::before { position: absolute; content: ""; height: 8px; width: 8px; background: #ffffff; bottom: -3px; left: 50%; transform: translate(-50%) rotate(45deg); 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; } .wrapper .icon:hover span, .wrapper .icon:hover .tooltip { text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.1); } .wrapper .facebook:hover, .wrapper .facebook:hover .tooltip, .wrapper .facebook:hover .tooltip::before { background: #1877F2; color: #ffffff; } .wrapper .twitter:hover, .wrapper .twitter:hover .tooltip, .wrapper .twitter:hover .tooltip::before { background: #1DA1F2; color: #ffffff; } .wrapper .instagram:hover, .wrapper .instagram:hover .tooltip, .wrapper .instagram:hover .tooltip::before { background: #E4405F; color: #ffffff; } .wrapper .github:hover, .wrapper .github:hover .tooltip, .wrapper .github:hover .tooltip::before { background: #333333; color: #ffffff; } .wrapper .youtube:hover, .wrapper .youtube:hover .tooltip, .wrapper .youtube:hover .tooltip::before { background: #CD201F; color: #ffffff; } |
And done you have successfully created this design. To view this all you need to do is to double click the index.html file and it will get open into your working browser.👍 If you get any error or have any problem related to topic you may ask in comment box.
<
License
___________________________________________________________________________________
The MIT License (MIT)
Copyright (c) 2022 by Aaditya1612 (https://codepen.io/aaditya1612/pen/wvyYRzj)
Fork of an original work Nav Bar Micro Interaction (https://codepen.io/abdelrhmansaid/pen/OJRNOpQ)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
___________________________________________________________________________________
Labels :
#css ,#frontend ,#html ,#web dev ,