Styling links with css examples

Содержание
  1. CSS Links
  2. Styling Links
  3. Example
  4. Example
  5. Text Decoration
  6. Example
  7. Background Color
  8. Example
  9. Link Buttons
  10. Example
  11. More Examples
  12. Example
  13. Example
  14. Example
  15. COLOR PICKER
  16. Report Error
  17. Thank You For Helping Us!
  18. CSS Links
  19. Styling Links
  20. Example
  21. Example
  22. Text Decoration
  23. Example
  24. Background Color
  25. Example
  26. Link Buttons
  27. Example
  28. More Examples
  29. Example
  30. Example
  31. Example
  32. COLOR PICKER
  33. Report Error
  34. Thank You For Helping Us!
  35. 56 CSS Link Hover Effects
  36. Related Articles
  37. Author
  38. Links
  39. Made with
  40. About a code
  41. Custom Animated Links with Psuedo Elements
  42. Author
  43. Links
  44. Made with
  45. About a code
  46. Hover Effect #4
  47. Author
  48. Links
  49. Made with
  50. About a code
  51. Hover Effect #5
  52. Author
  53. Links
  54. Made with
  55. About a code
  56. Hover Effect #6
  57. Author
  58. Links
  59. Made with
  60. About a code
  61. Hover Effect #7
  62. Author
  63. Links
  64. Made with
  65. About a code
  66. Hover Effect #1
  67. Author
  68. Links
  69. Made with
  70. About a code
  71. Hover Effect #2
  72. Author
  73. Links
  74. Made with
  75. About a code
  76. Mouse-Out Hover Effect
  77. Author
  78. Links
  79. Made with
  80. About a code
  81. Link Split Hover Effect
  82. Author
  83. Links
  84. Made with
  85. About a code
  86. Exploring Creative Link Hover Effects
  87. Author
  88. Links
  89. Made with
  90. About a code
  91. Fade out Other Links on Hover
  92. Author
  93. Links
  94. Made with
  95. About a code
  96. Laser Revealed Title Link
  97. Author
  98. Links
  99. Made with
  100. About a code
  101. Displaying Link URLs
  102. Author
  103. Links
  104. Made with
  105. About a code
  106. Neat Hover Effects
  107. Author
  108. Links
  109. Made with
  110. About a code
  111. Simple CSS Line Hover Animations for Links
  112. Author
  113. Links
  114. Made with
  115. About a code
  116. CSS Link Hover Animation
  117. Author
  118. Links
  119. Made with
  120. About a code
  121. Animated SVG Links
  122. Author
  123. Links
  124. Made with
  125. About a code
  126. Link Hover Animation
  127. Author
  128. Links
  129. Made with
  130. About a code
  131. Variable Powered Underline Transition
  132. Author
  133. Links
  134. Made with
  135. About a code
  136. Underline Animation — Link
  137. Author
  138. Links
  139. Made with
  140. About a code
  141. Link Hover Interaction
  142. Author
  143. Links
  144. Made with
  145. About a code
  146. Link Hover Flash
  147. Author
  148. Links
  149. Made with
  150. About a code
  151. Underline Animation
  152. Author
  153. Links
  154. Made with
  155. About a code
  156. Link Fill on Hover
  157. Author
  158. Links
  159. Made with
  160. About a code
  161. Underline Link Effect
  162. Author
  163. Links
  164. Made with
  165. About a code
  166. Half-transparent CurrentColor Link Underline
  167. Author
  168. Links
  169. Made with
  170. About a code
  171. Spring/Bounce Hover Effect
  172. Author
  173. Links
  174. Made with
  175. About the code
  176. Link Styling
  177. Author
  178. Links
  179. Made with
  180. About the code
  181. Flag # links!
  182. Author
  183. Links
  184. Made with
  185. About the code
  186. Link Effect
  187. Author
  188. Links
  189. Made with
  190. About the code
  191. Link with Gradient Background
  192. Author
  193. Links
  194. Made with
  195. About the code
  196. Animated Font Weight On Hover
  197. Author
  198. Links
  199. Made with
  200. About the code
  201. Multi-line Link
  202. Author
  203. Links
  204. Made with
  205. About the code
  206. Link Arrow
  207. Author
  208. Links
  209. Made with
  210. About the code
  211. Gradient Underline Animation
  212. Author
  213. Links
  214. Made with
  215. About the code
  216. Cool Hover Effect With mix-blend-mode
  217. Underline Hover
  218. Animate Underline Wavy
  219. Fancy Text-Shadow Link Underline
  220. Follow Along Links
  221. Pure CSS Single Element Link Styles
  222. Strikethrough Hover Effect
  223. Jumping Link Hovers
  224. Arrowed Link
  225. Author
Читайте также:  Css использование при форматировании html документа

With CSS, links can be styled in many different ways.

Links can be styled with any CSS property (e.g. color , font-family , background , etc.).

Example

In addition, links can be styled differently depending on what state they are in.

The four links states are:

  • a:link — a normal, unvisited link
  • a:visited — a link the user has visited
  • a:hover — a link when the user mouses over it
  • a:active — a link the moment it is clicked

Example

/* unvisited link */
a:link color: red;
>

/* visited link */
a:visited color: green;
>

/* mouse over link */
a:hover color: hotpink;
>

/* selected link */
a:active color: blue;
>

When setting the style for several link states, there are some order rules:

Text Decoration

The text-decoration property is mostly used to remove underlines from links:

Example

a:visited text-decoration: none;
>

a:hover text-decoration: underline;
>

a:active text-decoration: underline;
>

Background Color

The background-color property can be used to specify a background color for links:

Example

a:link <
background-color: yellow;
>

a:visited background-color: cyan;
>

a:hover background-color: lightgreen;
>

a:active background-color: hotpink;
>

This example demonstrates a more advanced example where we combine several CSS properties to display links as boxes/buttons:

Example

a:link, a:visited <
background-color: #f44336;
color: white;
padding: 14px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
>

a:hover, a:active background-color: red;
>

More Examples

Example

This example demonstrates how to add other styles to hyperlinks:

Example

Another example of how to create link boxes/buttons:

a:link, a:visited <
background-color: white;
color: black;
border: 2px solid green;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
>

a:hover, a:active background-color: green;
color: white;
>

Example

This example demonstrates the different types of cursors (can be useful for links):

Unlock Full Access 50% off

COLOR PICKER

colorpicker

Join our Bootcamp!

Report Error

If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:

Thank You For Helping Us!

Your message has been sent to W3Schools.

Top Tutorials
Top References
Top Examples
Get Certified

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Источник

With CSS, links can be styled in many different ways.

Links can be styled with any CSS property (e.g. color , font-family , background , etc.).

Example

In addition, links can be styled differently depending on what state they are in.

The four links states are:

  • a:link — a normal, unvisited link
  • a:visited — a link the user has visited
  • a:hover — a link when the user mouses over it
  • a:active — a link the moment it is clicked

Example

/* unvisited link */
a:link color: red;
>

/* visited link */
a:visited color: green;
>

/* mouse over link */
a:hover color: hotpink;
>

/* selected link */
a:active color: blue;
>

When setting the style for several link states, there are some order rules:

Text Decoration

The text-decoration property is mostly used to remove underlines from links:

Example

a:visited text-decoration: none;
>

a:hover text-decoration: underline;
>

a:active text-decoration: underline;
>

Background Color

The background-color property can be used to specify a background color for links:

Example

a:link <
background-color: yellow;
>

a:visited background-color: cyan;
>

a:hover background-color: lightgreen;
>

a:active background-color: hotpink;
>

This example demonstrates a more advanced example where we combine several CSS properties to display links as boxes/buttons:

Example

a:link, a:visited <
background-color: #f44336;
color: white;
padding: 14px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
>

a:hover, a:active background-color: red;
>

More Examples

Example

This example demonstrates how to add other styles to hyperlinks:

Example

Another example of how to create link boxes/buttons:

a:link, a:visited <
background-color: white;
color: black;
border: 2px solid green;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
>

a:hover, a:active background-color: green;
color: white;
>

Example

This example demonstrates the different types of cursors (can be useful for links):

Unlock Full Access 50% off

COLOR PICKER

colorpicker

Join our Bootcamp!

Report Error

If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:

Thank You For Helping Us!

Your message has been sent to W3Schools.

Top Tutorials
Top References
Top Examples
Get Certified

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Источник

Collection of hand-picked free HTML and CSS link effect code examples from Codepen, GitHub, and other resources with :hover and :active state. Update of May 2021 collection. Twelve new items.

Author

Made with

About a code

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Hover Effect #4

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Hover Effect #5

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Hover Effect #6

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Hover Effect #7

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Hover Effect #1

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Hover Effect #2

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Mouse-Out Hover Effect

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

The text is duplicated, masked with clip-path then psuedoelements and movements are animated with CSS transitions. The underscore is made with a linear gradient background image, but if you don’t plan to use a link like this over multiple lines of text, you could just use another pseudoelement.

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Demo image: Laser Revealed Title Link

Author

Made with

About a code

How to display the href attribute of a link next to the link text.

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Neat Hover Effects

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

A couple of simple & subtle CSS-based line hover animations for links.

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Variable Powered Underline Transition

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Underline Animation

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Link hover effects that fill a link with an underline or line-through using CSS transitions and the clip-path property.

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Animated underline/border link effect. Edit transform-origin to change how where the animation starts. It’s currently set to left.

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Demo image: Half-transparent CurrentColor Link Underline

Author

Made with

About a code

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About a code

Spring/Bounce Hover Effect

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Demo image: Link Styling

Author

Made with

About the code

Link styling exploration without classes.

Compatible browsers: Chrome, Firefox, Opera, Safari

Demo image: Flag # links!

Author

Made with

About the code

Broken link styles. Flag # links with CSS! Never forget a href=»#» placeholder again!

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About the code

HTML and CSS link squiggle effect.

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About the code

Link with gradient background on hover.

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Author

Made with

About the code

Animated Font Weight On Hover

Author

Made with

About the code

Multi-line link hover effect.

Demo image: Link Arrow

Author

Made with

About the code

Author

Made with

About the code

Gradient Underline Animation

Using a css background gradient and css animation this allows the animation of a link underline to carry across multiple lines. This previously would be achieved using the :pseudo elements. However doing this over multiple lines proved tricky.

Author

Made with

About the code

Cool Hover Effect With mix-blend-mode

This is cool because you don’t need to change the color of the link on :hover . The mix-blend-mode in the ::after will invert it for you.

Underline Hover

HTML and CSS underline hover effect.
Made by Elwin van den Hazel
July 12, 2017

Demo Image: Animate underline Wavy

Animate Underline Wavy

That cool wiggly underline that people like.
Made by David Darnes
July 10, 2017

Demo Image: Fancy Text-Shadow Link Underline

HTML and CSS fancy text-shadow link underline.
Made by Ryan
July 1, 2017

Hover on the links and it follows the cursor, highlighting the links as you go!
Made by Katherine Kato
June 23, 2017

Inspired by things that have seen from Medium and other peoples pens but with an added attempt at bringing in some animation. Currently limited to a link that is in total 10000px wide across all lines.
Made by Matthew Shields
June 24, 2017

Demo Image: Strikethrough Hover Effect

Strikethrough Hover Effect

Hover effect for links. Use only one pseudo-element on link.
Made by Artyom
June 23, 2017

Jumping link hovers with HTML and CSS.
Made by Bennett Feely
June 19, 2017

Arrowed link — circle on hover (cf Google home website).
Made by Alexandre Jolly
May 21, 2017

Author

Источник

Оцените статью