From the blog

The programming journey.

Button Hover Animation Effect

Button Hover Animation Effect

Style
Today we’d like to share some button styles and effects with you. We make it as light as posible, with pure css and html. This button style comes from <Link href="https://www.upwork.com/jobs/~012b6721285cc4889b" target="_blank">Upwork Jobs</Link>. We tried to create the button exacly the same with colors, interaction and shapes. <div className="flex justify-center items-center" style={{ height: "80px" }}> <button className="button-cta button--ehover"> <span>Get Started</span> </button> </div> <div className="flex justify-center items-center" style={{ height: "80px" }}> <button className="button-cta button--arrow"> <span>See Our Plans</span> </button> </div> <div className="flex justify-center items-center" style={{ height: "80px" }}> <button className="button-cta button--ripple"> <span>Get In Touch</span> </button> </div> The transparent button with a slightly rounded border seems to be quite popular on sites with image backgrounds. But there is no limit to roundedness, everything goes these days, which is great for creating fitting buttons for any design. What they all have in common is simplicity and effect subtleness. The button interaction is quite complicated, we need to give the button a wrapeer to hold the animation and mantain its concistency Some of the styles are a bit miss styled with this website — they might fit into some special designs. ### HTML ```html <button className="button-cta"> <span>Get In Touch</span> </button> ``` ### Style ```css .button-cta { overflow: hidden; background: black; color: white; font-size: 24px; border-radius: 50px; position: relative; border: none; transition: all 0.3s ease; padding: 15px 40px; } .button-cta:hover { padding: 18px 48px; } ``` Thats for base button style --- ## Ripple Hover Effect Let's start! The first one is ripple overlay on hover effect ### Result <div className="flex justify-center items-center" style={{ height: "80px" }}> <button className="button-cta button--ehover"> <span>Get Started</span> </button> </div> ### HTML ```html <button className="button-cta button--ripple">...</button> ``` For style we use backdrop filter with contrast 0.7 to make the overlay lighter ### Style ```css .button-cta.button--ripple:before { content: ""; position: absolute; top: 0; bottom: 0; right: 0; left: 0; transition: all 0.8s; display: block; margin: auto; width: 0; height: 0; border-radius: 100px; animation: ripple-animation 0.5s; backdrop-filter: contrast(0.7); } .button-cta.button--ripple:hover:before { width: 100%; height: 100%; animation: ripple-animation-reverse 0.5s; } ``` ### Animation ```css @keyframes ripple-animation { 0% { width: 100%; height: 100%; } 12% { width: 89%; height: 89%; } 24% { width: 56%; height: 56%; } 36% { width: 2%; height: 25; } 54% { width: 25px; height: 25px; } 74% { width: 5px; height: 5px; } 82% { width: 10px; height: 10px; } 92% { width: 2px; height: 2px; } 96% { width: 5px; height: 5px; } 100% { width: 0; height: 0; } } @keyframes ripple-animation-reverse { 0% { width: 0; height: 0; } 25% { width: 25px; height: 25px; } 100% { width: 100%; width: 100%; } } ``` --- ## Button Outline Hover Ripple Effect Next one we buikt the outline version of the button ### Result <div className="flex justify-center items-center" style={{ height: "80px" }}> <button className="button-cta button--ripple"> <span>Get In Touch</span> </button> </div> ### HTML ```html <button className="button-cta button--ripple-outline">...</button> ``` ### Style ```css .button-cta.button--ripple-outline { border: 2px solid black; background: transparent; color: black; } .button-cta.button--ripple-outline:hover { color: white; } .button-cta.button--ripple-outline:before { content: ""; position: absolute; top: 0; bottom: 0; right: 0; left: 0; transition: all 0.8s; background: black; display: block; margin: auto; width: 0; height: 0; border-radius: 100px; animation: ripple-animation 0.5s; z-index: -1; } .button-cta.button--ripple-outline:hover:before { width: 100%; height: 100%; animation: ripple-animation-reverse 0.5s; } ``` We still reuse the animation from ripple effect of block button --- ## Arrow Around Effect Last one we play with the arrow animation. We not use icon in this article, but the conseft was exacly the same, we just need to adjust the psuedo hover to the icon ### Result <div className="flex justify-center items-center" style={{ height: "80px" }}> <button className="button-cta button--arrow"> <span>See Our Plans</span> </button> </div> ### HTML ```html <button className="button-cta button--arrow">...</button> ``` ```css .button-cta.button--arrow { padding: 15px 50px 15px 40px; } .button-cta.button--arrow:after { content: "↓"; position: absolute; margin-left: 10px; transition: all 0.3s ease; } .button-cta:hover.button--arrow { padding: 18px 60px 18px 48px; } .button-cta:hover.button--arrow:after { animation: arrow-animation 0.3s ease; } @keyframes arrow-animation { 0% { bottom: 25%; } 50% { bottom: -25%; } 51% { bottom: 100%; } 100% { bottom: 25%; } } ``` Thats all for today, we hope you enjoy the article. Thank you <style> {` .button-cta { overflow: hidden; background: black; color: white; font-size: 24px; border-radius: 50px; position: relative; border: none; transition: all 0.3s ease; padding: 15px 40px; } .button-cta.button--ehover:before { content: ""; position: absolute; top: 0; bottom: 0; right: 0; left: 0; transition: all 0.8s; display: block; margin: auto; width: 0; height: 0; border-radius: 100px; animation: ripple-animation 0.5s; backdrop-filter: contrast(0.7); } .button-cta.button--ehover:hover:before { width: 100%; height: 100%; animation: ripple-animation-reverse 0.5s; } .button-cta.button--ripple { border: 2px solid black; background: transparent; color: black; } .button-cta.button--ripple:hover { color: white; } .button-cta.button--ripple:before { content: ""; position: absolute; top: 0; bottom: 0; right: 0; left: 0; transition: all 0.8s; background: black; display: block; margin: auto; width: 0; height: 0; border-radius: 100px; animation: ripple-animation 0.5s; z-index: -1; } .button-cta.button--ripple:hover:before { width: 100%; height: 100%; animation: ripple-animation-reverse 0.5s; } .button-cta.button--arrow { padding: 15px 50px 15px 40px; } .button-cta.button--arrow:after { content: "↓"; position: absolute; margin-left: 10px; transition: all 0.3s ease; } .button-cta:hover { padding: 18px 48px; } .button-cta:hover.button--arrow { padding: 18px 60px 18px 48px; } .button-cta:hover.button--arrow:after { animation: arrow-animation 0.3s ease; } @keyframes arrow-animation { 0% { bottom: 25%; } 50% { bottom: -25%; } 51% { bottom: 100%; } 100% { bottom: 25%; } } @keyframes ripple-animation { 0% { width: 100%; height: 100%; } 12% { width: 89%; height: 89%; } 24% { width: 56%; height: 56%; } 36% { width: 2%; height: 25; } 54% { width: 25px; height: 25px; } 74% { width: 5px; height: 5px; } 82% { width: 10px; height: 10px; } 92% { width: 2px; height: 2px; } 96% { width: 5px; height: 5px; } 100% { width: 0; height: 0; } } @keyframes ripple-animation-reverse { 0% { width: 0; height: 0; } 25% { width: 25px; height: 25px; } 100% { width: 100%; width: 100%; } } `} </style>
Ikhsanuddin Syamsuri

Ikhsanuddin Syamsuri

Sofware Engineer

Markdown Format

Markdown Format

Example
``` # h1 Heading ## h2 Heading ### h3 Heading #### h4 Heading ##### h5 Heading ###### h6 Heading Alternatively, for H1 and H2, an underline-ish style: Alt-H1 ====== Alt-H2 ------ ``` # h1 Heading 8-) ## h2 Heading ### h3 Heading #### h4 Heading ##### h5 Heading ###### h6 Heading Alternatively, for H1 and H2, an underline-ish style: Alt-H1 ====== Alt-H2 ------ ------ # Emphasis ``` Emphasis, aka italics, with *asterisks* or _underscores_. Strong emphasis, aka bold, with **asterisks** or __underscores__. Combined emphasis with **asterisks and _underscores_**. Strikethrough uses two tildes. ~~Scratch this.~~ **This is bold text** __This is bold text__ *This is italic text* _This is italic text_ ~~Strikethrough~~ ``` Emphasis, aka italics, with *asterisks* or _underscores_. Strong emphasis, aka bold, with **asterisks** or __underscores__. Combined emphasis with **asterisks and _underscores_**. Strikethrough uses two tildes. ~~Scratch this.~~ **This is bold text** __This is bold text__ *This is italic text* _This is italic text_ ~~Strikethrough~~ ------ # Lists ``` 1. First ordered list item 2. Another item ⋅⋅* Unordered sub-list. 1. Actual numbers don't matter, just that it's a number ⋅⋅1. Ordered sub-list 4. And another item. ⋅⋅⋅You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown). ⋅⋅⋅To have a line break without a paragraph, you will need to use two trailing spaces.⋅⋅ ⋅⋅⋅Note that this line is separate, but within the same paragraph.⋅⋅ ⋅⋅⋅(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.) * Unordered list can use asterisks - Or minuses + Or pluses 1. Make my changes 1. Fix bug 2. Improve formatting - Make the headings bigger 2. Push my commits to GitHub 3. Open a pull request * Describe my changes * Mention all the members of my team * Ask for feedback + Create a list by starting a line with `+`, `-`, or `*` + Sub-lists are made by indenting 2 spaces: - Marker character change forces new list start: * Ac tristique libero volutpat at + Facilisis in pretium nisl aliquet - Nulla volutpat aliquam velit + Very easy! ``` 1. First ordered list item 2. Another item ⋅⋅* Unordered sub-list. 1. Actual numbers don't matter, just that it's a number ⋅⋅1. Ordered sub-list 4. And another item. ⋅⋅⋅You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown). ⋅⋅⋅To have a line break without a paragraph, you will need to use two trailing spaces.⋅⋅ ⋅⋅⋅Note that this line is separate, but within the same paragraph.⋅⋅ ⋅⋅⋅(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.) * Unordered list can use asterisks - Or minuses + Or pluses 1. Make my changes 1. Fix bug 2. Improve formatting - Make the headings bigger 2. Push my commits to GitHub 3. Open a pull request * Describe my changes * Mention all the members of my team * Ask for feedback + Create a list by starting a line with `+`, `-`, or `*` + Sub-lists are made by indenting 2 spaces: - Marker character change forces new list start: * Ac tristique libero volutpat at + Facilisis in pretium nisl aliquet - Nulla volutpat aliquam velit + Very easy! ------ # Task lists ``` - [x] Finish my changes - [ ] Push my commits to GitHub - [ ] Open a pull request - [x] @mentions, #refs, [links](), **formatting**, and <del>tags</del> supported - [x] list syntax required (any unordered or ordered list supported) - [x] this is a complete item - [ ] this is an incomplete item ``` - [x] Finish my changes - [ ] Push my commits to GitHub - [ ] Open a pull request - [x] @mentions, #refs, [links](), **formatting**, and <del>tags</del> supported - [x] list syntax required (any unordered or ordered list supported) - [ ] this is a complete item - [ ] this is an incomplete item ------ # Ignoring Markdown formatting You can tell GitHub to ignore (or escape) Markdown formatting by using \ before the Markdown character. ``` Let's rename \*our-new-project\* to \*our-old-project\*. ``` Let's rename \*our-new-project\* to \*our-old-project\*. ------ # Links ``` [I'm an inline-style link](https://www.google.com) [I'm an inline-style link with title](https://www.google.com "Google's Homepage") [I'm a reference-style link][Arbitrary case-insensitive reference text] [I'm a relative reference to a repository file](../blob/master/LICENSE) [You can use numbers for reference-style link definitions][1] Or leave it empty and use the [link text itself]. URLs and URLs in angle brackets will automatically get turned into links. http://www.example.com or <http://www.example.com> and sometimes example.com (but not on Github, for example). Some text to show that the reference links can follow later. [arbitrary case-insensitive reference text]: https://www.mozilla.org [1]: http://slashdot.org [link text itself]: http://www.reddit.com ``` [I'm an inline-style link](https://www.google.com) [I'm an inline-style link with title](https://www.google.com "Google's Homepage") [I'm a reference-style link][Arbitrary case-insensitive reference text] [I'm a relative reference to a repository file](../blob/master/LICENSE) [You can use numbers for reference-style link definitions][1] Or leave it empty and use the [link text itself]. URLs and URLs in angle brackets will automatically get turned into links. http://www.example.com or and sometimes example.com (but not on Github, for example). Some text to show that the reference links can follow later. [arbitrary case-insensitive reference text]: https://www.mozilla.org [1]: http://slashdot.org [link text itself]: http://www.reddit.com ------ # Images ``` Here's our logo (hover to see the title text): Inline-style: ![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1") Reference-style: ![alt text][logo] [logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2" ![Minion](https://octodex.github.com/images/minion.png) ![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat") Like links, Images also have a footnote style syntax ![Alt text][id] With a reference later in the document defining the URL location: [id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat" ``` Here's our logo (hover to see the title text): Inline-style: ![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1") Reference-style: ![alt text][logo] [logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2" ![Minion](https://octodex.github.com/images/minion.png) ![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat") Like links, Images also have a footnote style syntax ![Alt text][id] With a reference later in the document defining the URL location: [id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat" ------ # [Footnotes](https://github.com/markdown-it/markdown-it-footnote) ``` Footnote 1 link[^first]. Footnote 2 link[^second]. Inline footnote^[Text of inline footnote] definition. Duplicated footnote reference[^second]. [^first]: Footnote **can have markup** and multiple paragraphs. [^second]: Footnote text. ``` Footnote 1 link[^first]. Footnote 2 link[^second]. Inline footnote^[Text of inline footnote] definition. Duplicated footnote reference[^second]. [^first]: Footnote **can have markup** and multiple paragraphs. [^second]: Footnote text. ------ # Code and Syntax Highlighting ``` Inline `code` has `back-ticks around` it. ``` Inline `code` has `back-ticks around` it. ```c# using System.IO.Compression; #pragma warning disable 414, 3021 namespace MyApplication { [Obsolete("...")] class Program : IInterface { public static List<int> JustDoIt(int count) { Console.WriteLine($"Hello {Name}!"); return new List<int>(new int[] { 1, 2, 3 }) } } } ``` ```css @font-face { font-family: Chunkfive; src: url('Chunkfive.otf'); } body, .usertext { color: #F0F0F0; background: #600; font-family: Chunkfive, sans; } @import url(print.css); @media print { a[href^=http]::after { content: attr(href) } } ``` ```javascript function $initHighlight(block, cls) { try { if (cls.search(/\bno\-highlight\b/) != -1) return process(block, true, 0x0F) + ` class="${cls}"`; } catch (e) { /* handle exception */ } for (var i = 0 / 2; i < classes.length; i++) { if (checkCondition(classes[i]) === undefined) console.log('undefined'); } } export $initHighlight; ``` ```php require_once 'Zend/Uri/Http.php'; namespace Location\Web; interface Factory { static function _factory(); } abstract class URI extends BaseURI implements Factory { abstract function test(); public static $st1 = 1; const ME = "Yo"; var $list = NULL; private $var; /** * Returns a URI * * @return URI */ static public function _factory($stats = array(), $uri = 'http') { echo __METHOD__; $uri = explode(':', $uri, 0b10); $schemeSpecific = isset($uri[1]) ? $uri[1] : ''; $desc = 'Multi line description'; // Security check if (!ctype_alnum($scheme)) { throw new Zend_Uri_Exception('Illegal scheme'); } $this->var = 0 - self::$st; $this->list = list(Array("1"=> 2, 2=>self::ME, 3 => \Location\Web\URI::class)); return [ 'uri' => $uri, 'value' => null, ]; } } echo URI::ME . URI::$st1; __halt_compiler () ; datahere datahere datahere */ datahere ``` ------ # Tables ``` Colons can be used to align columns. | Tables | Are | Cool | | ------------- |:-------------:| -----:| | col 3 is | right-aligned | $1600 | | col 2 is | centered | $12 | | zebra stripes | are neat | $1 | There must be at least 3 dashes separating each header cell. The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown. Markdown | Less | Pretty --- | --- | --- *Still* | `renders` | **nicely** 1 | 2 | 3 | First Header | Second Header | | ------------- | ------------- | | Content Cell | Content Cell | | Content Cell | Content Cell | | Command | Description | | --- | --- | | git status | List all new or modified files | | git diff | Show file differences that haven't been staged | | Command | Description | | --- | --- | | `git status` | List all *new or modified* files | | `git diff` | Show file differences that **haven't been** staged | | Left-aligned | Center-aligned | Right-aligned | | :--- | :---: | ---: | | git status | git status | git status | | git diff | git diff | git diff | | Name | Character | | --- | --- | | Backtick | ` | | Pipe | \| | ``` Colons can be used to align columns. | Tables | Are | Cool | | ------------- |:-------------:| -----:| | col 3 is | right-aligned | $1600 | | col 2 is | centered | $12 | | zebra stripes | are neat | $1 | There must be at least 3 dashes separating each header cell. The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown. Markdown | Less | Pretty --- | --- | --- *Still* | `renders` | **nicely** 1 | 2 | 3 | First Header | Second Header | | ------------- | ------------- | | Content Cell | Content Cell | | Content Cell | Content Cell | | Command | Description | | --- | --- | | git status | List all new or modified files | | git diff | Show file differences that haven't been staged | | Command | Description | | --- | --- | | `git status` | List all *new or modified* files | | `git diff` | Show file differences that **haven't been** staged | | Left-aligned | Center-aligned | Right-aligned | | :--- | :---: | ---: | | git status | git status | git status | | git diff | git diff | git diff | | Name | Character | | --- | --- | | Backtick | ` | | Pipe | \| | ------ # Blockquotes ``` > Blockquotes are very handy in email to emulate reply text. > This line is part of the same quote. Quote break. > This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote. > Blockquotes can also be nested... >> ...by using additional greater-than signs right next to each other... > > > ...or with spaces between arrows. ``` > Blockquotes are very handy in email to emulate reply text. > This line is part of the same quote. Quote break. > This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote. > Blockquotes can also be nested... >> ...by using additional greater-than signs right next to each other... > > > ...or with spaces between arrows. ------ # Inline HTML ``` <dl> <dt>Definition list</dt> <dd>Is something people use sometimes.</dd> <dt>Markdown in HTML</dt> <dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd> </dl> ``` <dl> <dt>Definition list</dt> <dd>Is something people use sometimes.</dd> <dt>Markdown in HTML</dt> <dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd> </dl> ------ # Horizontal Rules ``` Three or more... --- Hyphens *** Asterisks ___ Underscores ``` Three or more... --- Hyphens *** Asterisks ___ Underscores ------ # YouTube Videos ``` <img src="https://img.youtube.com/vi/82HM0z6qd20/0.jpg" alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /> ``` <img src="https://img.youtube.com/vi/82HM0z6qd20/0.jpg" alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /> ``` [![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/82HM0z6qd20/0.jpg)](http://www.youtube.com/watch?v=82HM0z6qd20) ``` [![IMAGE ALT TEXT HERE](https://upload.wikimedia.org/wikipedia/commons/thumb/e/ef/YouTube_logo_2015.svg/1200px-YouTube_logo_2015.svg.png)](https://www.youtube.com/watch?v=ciawICBvQoE)
Ikhsanuddin Syamsuri

Ikhsanuddin Syamsuri

Sofware Engineer