• Register now to get access to thousands of Tutorials, Leaked content, Hot NSFW and much more. Join us as we build and grow the community.

Advertise Here

Advertise Here

Advertise Here

Creating a Cool Social Media Links for Websites using HTML and CSS Tutorial

santi20

Platform Niche Strategist
S Rep
0
0
0
Rep
0
S Vouches
0
0
0
Vouches
0
Posts
120
Likes
68
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 2 1000 XP
In this tutorial, we'll guide you through the process of crafting an engaging and interactive user interface featuring stylish Cool Hoverable Social Media Links/Buttons with subtle animations using HTML and CSS. This tutorial serves as a valuable resource, particularly for newbies and students seeking to learn essential web design techniques. Within this tutorial, we'll furnish you with the source code for a straightforward web page that includes these captivating Social Media Links/Buttons.

Understanding Social Media Links on Websites

Social Media Links refer to the external links on a website that direct users to the social media pages of organizations or companies. They play a pivotal role in a website's link-building strategy, creating additional organic avenues to expand a company's or organization's brand presence within a target market.

What Type of Social Media Links UI Are We Creating?

In this tutorial, we'll offer HTML and CSS code snippets to guide you in building a Social Media Links UI with a clean, yet creative design for your forthcoming website or web application projects. This Social Media Links UI features icons, text, and subtle sliding or expanding animations upon hovering over each link.

What You Need?

For this straightforward web application development using HTML and CSS, you will only require the following:

  • Text Editor: You can use tools like Notepad++, Sublime Text, or VS Code.
  • Web Browser: Any modern browser such as Chrome, Mozilla Firefox, or MS Edge will suffice.

Constructing Page Elements

Our initial step is to establish the application's index file. Open your preferred text editor and create a new HTML

file, saving it as index.html

. This file encompasses the essential HTML elements for the page interface, including the Social Media Links anchor tags and corresponding icons. We'll be utilizing a CDN to load the Fontawesome library for these icons.

Below, you'll find the HTML code I've prepared for this tutorial:

  1. <!DOCTYPE html>
  2. <html

    lang

    =

    "en"

    >
  3. <head

    >
  4. <meta

    charset

    =

    "UTF-8"

    >
  5. <meta

    name

    =

    "viewport"

    content

    =

    "width=device-width, initial-scale=1.0"

    >
  6. <title

    >

    Cool Hoverable Social Media Link | SourceCodester </

    title

    >
  7. <!-- Fontaweseome -->
  8. <link

    rel

    =

    "stylesheet"

    href

    =

    "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"

    integrity=

    "sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA=="

    crossorigin=

    "anonymous"

    referrerpolicy=

    "no-referrer"

    /

    >
  9. <link

    rel

    =

    "stylesheet"

    href

    =

    "styles.css"

    >
  10. </

    head

    >
  11. <body

    >
  12. <main>
  13. <div

    id

    =

    "wrapper"

    >
  14. <h2

    class

    =

    "title"

    >

    Cool Hoverable Social Media Link</

    h2

    >
  15. <!-- SocMed Links -->
  16. <div

    id

    =

    "soc-med-links"

    >
  17. <!-- Social Media Link Item -->
  18. <div

    class

    =

    "soc-med-links-item"

    >
  19. <a

    href

    =

    "https://www.facebook.com/SourceCodester"

    target

    =

    "_blank"

    >
  20. <!-- Social Media Link Item Icon Element -->
  21. <div

    class

    =

    "soc-med-links-item-icon bg-primary"

    >
  22. <i

    class

    =

    "fa-brands fa-facebook-f"

    ></

    i

    >
  23. </

    div

    >
  24. <!-- Social Media Link Item Text Element -->
  25. <div

    class

    =

    "soc-med-links-item-text"

    >
  26. SourceCodester
  27. </

    div

    >
  28. </

    a

    >
  29. </

    div

    >
  30. <!-- Social Media Link Item -->
  31. <div

    class

    =

    "soc-med-links-item"

    >
  32. <a

    href

    =

    "https://twitter.com/intent/follow?o...region=follow_link&screen_name=sourcecodester"

    target

    =

    "_blank"

    >
  33. <!-- Social Media Link Item Icon Element -->
  34. <div

    class

    =

    "soc-med-links-item-icon bg-secondary"

    >
  35. <i

    class

    =

    "fa-brands fa-x-twitter"

    ></

    i

    >
  36. </

    div

    >
  37. <!-- Social Media Link Item Text Element -->
  38. <div

    class

    =

    "soc-med-links-item-text"

    >
  39. SourceCodester
  40. </

    div

    >
  41. </

    a

    >
  42. </

    div

    >
  43. <!-- Social Media Link Item -->
  44. <div

    class

    =

    "soc-med-links-item"

    >
  45. <a

    href

    =

    "https://github.com"

    target

    =

    "_blank"

    >
  46. <!-- Social Media Link Item Icon Element -->
  47. <div

    class

    =

    "soc-med-links-item-icon bg-dark"

    >
  48. <i

    class

    =

    "fa-brands fa-github"

    ></

    i

    >
  49. </

    div

    >
  50. <!-- Social Media Link Item Text Element -->
  51. <div

    class

    =

    "soc-med-links-item-text"

    >
  52. GitHub
  53. </

    div

    >
  54. </

    a

    >
  55. </

    div

    >
  56. <!-- Social Media Link Item -->
  57. <div

    class

    =

    "soc-med-links-item"

    >
  58. <a

    href

    =

    "https://www.instagram.com/"

    target

    =

    "_blank"

    >
  59. <!-- Social Media Link Item Icon Element -->
  60. <div

    class

    =

    "soc-med-links-item-icon bg-gradient"

    >
  61. <i

    class

    =

    "fa-brands fa-instagram"

    ></

    i

    >
  62. </

    div

    >
  63. <!-- Social Media Link Item Text Element -->
  64. <div

    class

    =

    "soc-med-links-item-text"

    >
  65. Instagram
  66. </

    div

    >
  67. </

    a

    >
  68. </

    div

    >
  69. <!-- Social Media Link Item -->
  70. <div

    class

    =

    "soc-med-links-item"

    >
  71. <a

    href

    =

    "https://www.youtube.com/@sourcecodester247"

    target

    =

    "_blank"

    >
  72. <!-- Social Media Link Item Icon Element -->
  73. <div

    class

    =

    "soc-med-links-item-icon bg-red"

    >
  74. <i

    class

    =

    "fa-brands fa-youtube"

    ></

    i

    >
  75. </

    div

    >
  76. <!-- Social Media Link Item Text Element -->
  77. <div

    class

    =

    "soc-med-links-item-text"

    >
  78. SourceCodester
  79. </

    div

    >
  80. </

    a

    >
  81. </

    div

    >
  82. </

    div

    >
  83. </

    div

    >
  84. </

    main>
  85. </

    body

    >
  86. </

    html

    >

Developing the CSS File

Next, we'll create the CSS

file, which houses the styling scripts for the page element interface and design. Begin by generating a new CSS

file and save it with the name styles.css

. Remember, this file is linked and loaded within the HTML

code file.

  1. @import

    url

    (

    'https://fonts.googleapis.com/css2?f...00;1,100;1,200;1,300;1,400;1,500&display=swap'

    )

    ;

  2. :

    root

    {
  3. --bg-primary

    :

    #3876BF

    ;
  4. --bg-secondary

    :

    #4D4C7D

    ;
  5. --bg-red

    :

    #D80032

    ;
  6. --bg-dark

    :

    #352F44

    ;
  7. --bg-warn

    :

    #FBDA61

    ;
  8. --bg-gradient

    :

    linear-gradient(

    45deg

    ,

    #FBDA61

    0%

    ,

    #FF5ACD

    100%

    )

    ;
  9. }

  10. *

    {
  11. font-family

    :

    'Exo 2'

    ,

    sans-serif

    ;;
  12. }
  13. /* Page Interface Design */
  14. html,

    body{
  15. width

    :

    100%

    ;
  16. height

    :

    100%

    ;
  17. margin

    :

    unset;
  18. padding

    :

    unset;
  19. }

  20. body{
  21. background-color

    :

    #0093E9

    ;
  22. background-image

    :

    linear-gradient(

    160deg

    ,

    #0093E9

    0%

    ,

    #80D0C7

    100%

    )

    ;
  23. }

  24. main{
  25. width

    :

    100%

    ;
  26. height

    :

    100%

    ;
  27. display

    :

    flex;
  28. flex-flow

    :

    column wrap;
  29. align-items

    :

    center

    ;
  30. justify-content

    :

    center

    ;
  31. }
  32. #wrapper

    {
  33. width

    :

    100%

    ;
  34. max-width

    :

    500px

    ;
  35. }
  36. /* Page Title */
  37. h2.title{
  38. font-weight

    :

    bold

    ;
  39. color

    :

    #fff

    ;
  40. letter-spacing

    :

    0.3px

    ;
  41. text-align

    :

    center

    ;
  42. }

  43. /* Social Media Links Styles */

  44. /* Social Media Links or Button Wrapper */
  45. #soc-med-links

    {
  46. display

    :

    flex;
  47. flex-flow

    :

    row wrap;
  48. min-width

    :

    100px

    ;
  49. max-width

    :

    100%

    ;
  50. column-gap

    :

    10px

    ;
  51. justify-content

    :

    space-between;
  52. }

  53. /* Social Media Link Item */
  54. #soc-med-links

    .soc-med-links-item

    {
  55. box-shadow

    :

    0px

    3px

    3px

    #0000003a

    ;
  56. background-color

    :

    #fff

    ;
  57. border-radius

    :

    2rem

    ;
  58. transition

    :

    all .3s

    ease-in-out;
  59. }

  60. /* Social Media Link Item anchor tag Element */

  61. #soc-med-links

    .soc-med-links-item

    a{
  62. text-decoration

    :

    none

    !important;
  63. color

    :

    #352F44

    !important;
  64. display

    :

    flex;
  65. align-items

    :

    center

    ;
  66. justify-content

    :

    center

    ;
  67. }

  68. /* Social Media Link Item Icon/Logo Element */
  69. #soc-med-links

    .soc-med-links-item

    .soc-med-links-item-icon

    {
  70. height

    :

    50px

    ;
  71. width

    :

    50px

    ;
  72. display

    :

    flex;
  73. flex-direction

    :

    column;
  74. align-items

    :

    center

    ;
  75. justify-content

    :

    center

    ;
  76. border

    :

    1px

    solid

    #e8e8e8

    ;
  77. background-color

    :

    #fff

    ;
  78. border-radius

    :

    50%

    50%

    ;
  79. font-size

    :

    2rem

    ;
  80. }

  81. /* Social Media Link Item Text Element */
  82. #soc-med-links

    .soc-med-links-item

    .soc-med-links-item-text

    {
  83. font-size

    :

    14px

    ;
  84. font-weight

    :

    600

    ;
  85. letter-spacing

    :

    .5px

    ;
  86. overflow

    :

    hidden

    ;
  87. width

    :

    0

    ;
  88. }

  89. /* Social Media Link Icon when Hovered */
  90. #soc-med-links

    .soc-med-links-item

    :

    hover

    .soc-med-links-item-icon{
  91. position

    :

    relative

    ;
  92. top

    :

    1px

    ;
  93. left

    :

    1px

    ;
  94. border

    :

    unset;
  95. }

  96. /* Social Media Link when Hovered Colors */
  97. #soc-med-links

    .soc-med-links-item

    :

    hover

    .soc-med-links-item-icon

    .bg-primary{
  98. background-color

    :

    var

    (

    --bg-primary

    )

    ;
  99. color

    :

    #fff

    ;
  100. }
  101. #soc-med-links

    .soc-med-links-item

    :

    hover

    .soc-med-links-item-icon

    .bg-secondary{
  102. background-color

    :

    var

    (

    --bg-secondary

    )

    ;
  103. color

    :

    #fff

    ;
  104. }
  105. #soc-med-links

    .soc-med-links-item

    :

    hover

    .soc-med-links-item-icon

    .bg-dark{
  106. background-color

    :

    var

    (

    --bg-dark

    )

    ;
  107. color

    :

    #fff

    ;
  108. }
  109. #soc-med-links

    .soc-med-links-item

    :

    hover

    .soc-med-links-item-icon

    .bg-red{
  110. background-color

    :

    var

    (

    --bg-red

    )

    ;
  111. color

    :

    #fff

    ;
  112. }
  113. #soc-med-links

    .soc-med-links-item

    :

    hover

    .soc-med-links-item-icon

    .bg-gradient{
  114. background-color

    :

    var

    (

    --bg-warn

    )

    ;
  115. background-image

    :

    var

    (

    --bg-gradient

    )

    ;
  116. color

    :

    #fff

    ;
  117. }

  118. /* Adding animation when hovering */
  119. #soc-med-links

    .soc-med-links-item

    :

    hover

    .soc-med-links-item-text{
  120. animation

    :

    expandingAnimation .5s

    ease forwards

    ;
  121. }

  122. /* Expanding the Link Text Animation */

  123. @keyframes

    expandingAnimation {
  124. 0%

    {
  125. width

    :

    0

    ;
  126. margin

    :

    0px

    0px

    ;
  127. }
  128. 100%

    {
  129. width

    :

    auto

    ;
  130. margin

    :

    5px

    10px

    ;
  131. }
  132. }

For the outcome of the provided script, please consult the following images:

Social Media Links in Their Default State

Social Media Links on Hover

And there you have it! I hope this tutorial on creating a Cool Hoverable Social Media Links/Buttons UI using HTML and CSS will be beneficial and prove valuable for your future website or web application projects. Additionally, a compressed source code file is available within this article for download. You can access it by clicking the download button located below this article's content.

Explore further on this website for more Free Source Codes, Tutorials, and Articles covering various programming languages.

Happy Coding =)


Download
You must upgrade your account or reply in the thread to view the hidden content.
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

452,501

351,349

351,363

Top