Bismillahirrahmanirrahiim … Alright today I will discuss how to add a modern link effect with CSS3 so it looks more beautiful and elegant. Actually, to add the effect of the link, we can make it yourself with a little modification of CSS source code. But this time I will help open your inspiration and increase knowledge for all of us on creating link effects and hover effects on links on our respective websites.
A little explanation from me, the link effect I mean is modifying the effect on the link by adding transitions to the hover link. So when the mouse cursor is directed to the link, it will display a beautiful effect based on the CSS class that was added. For more details, please just see the demo by clicking on the “DEMO” button that I provide below.
It should be noted, Modern Link Effect is not all can run well on all browsers. This link effect will work very well on the Chrome browser and Firefox. Of course it works very well on browsers that support CSS3 and HTML5. Immediately, instead of me talking there talking here, I will guide you directly to implement this link effect: D Please note my explanation below.
Adding Modern and Beautiful Link Effects with CSS3
The most important step is to add the following CSS to your project:
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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 |
/* Effect 1: Brackets */ .cl-effect-1 a::before, .cl-effect-1 a::after { display: inline-block; opacity: 0; -webkit-transition: -webkit-transform 0.3s, opacity 0.2s; -moz-transition: -moz-transform 0.3s, opacity 0.2s; transition: transform 0.3s, opacity 0.2s; } .cl-effect-1 a::before { margin-right: 10px; content: '['; -webkit-transform: translateX(20px); -moz-transform: translateX(20px); transform: translateX(20px); } .cl-effect-1 a::after { margin-left: 10px; content: ']'; -webkit-transform: translateX(-20px); -moz-transform: translateX(-20px); transform: translateX(-20px); } .cl-effect-1 a:hover::before, .cl-effect-1 a:hover::after, .cl-effect-1 a:focus::before, .cl-effect-1 a:focus::after { opacity: 1; -webkit-transform: translateX(0px); -moz-transform: translateX(0px); transform: translateX(0px); } /* Effect 2: 3D rolling links, idea from http://hakim.se/thoughts/rolling-links */ .cl-effect-2 a { line-height: 44px; -webkit-perspective: 1000px; -moz-perspective: 1000px; perspective: 1000px; } .cl-effect-2 a span { position: relative; display: inline-block; padding: 0 14px; background: #2195de; -webkit-transition: -webkit-transform 0.3s; -moz-transition: -moz-transform 0.3s; transition: transform 0.3s; -webkit-transform-origin: 50% 0; -moz-transform-origin: 50% 0; transform-origin: 50% 0; -webkit-transform-style: preserve-3d; -moz-transform-style: preserve-3d; transform-style: preserve-3d; } .csstransforms3d .cl-effect-2 a span::before { position: absolute; top: 100%; left: 0; width: 100%; height: 100%; background: #0965a0; content: attr(data-hover); -webkit-transition: background 0.3s; -moz-transition: background 0.3s; transition: background 0.3s; -webkit-transform: rotateX(-90deg); -moz-transform: rotateX(-90deg); transform: rotateX(-90deg); -webkit-transform-origin: 50% 0; -moz-transform-origin: 50% 0; transform-origin: 50% 0; } .cl-effect-2 a:hover span, .cl-effect-2 a:focus span { -webkit-transform: rotateX(90deg) translateY(-22px); -moz-transform: rotateX(90deg) translateY(-22px); transform: rotateX(90deg) translateY(-22px); } .csstransforms3d .cl-effect-2 a:hover span::before, .csstransforms3d .cl-effect-2 a:focus span::before { background: #28a2ee; } /* Effect 3: bottom line slides/fades in */ .cl-effect-3 a { padding: 8px 0; } .cl-effect-3 a::after { position: absolute; top: 100%; left: 0; width: 100%; height: 4px; background: rgba(0,0,0,0.1); content: ''; opacity: 0; -webkit-transition: opacity 0.3s, -webkit-transform 0.3s; -moz-transition: opacity 0.3s, -moz-transform 0.3s; transition: opacity 0.3s, transform 0.3s; -webkit-transform: translateY(10px); -moz-transform: translateY(10px); transform: translateY(10px); } .cl-effect-3 a:hover::after, .cl-effect-3 a:focus::after { opacity: 1; -webkit-transform: translateY(0px); -moz-transform: translateY(0px); transform: translateY(0px); } /* Effect 4: bottom border enlarge */ .cl-effect-4 a { padding: 0 0 10px; } .cl-effect-4 a::after { position: absolute; top: 100%; left: 0; width: 100%; height: 1px; background: #fff; content: ''; opacity: 0; -webkit-transition: height 0.3s, opacity 0.3s, -webkit-transform 0.3s; -moz-transition: height 0.3s, opacity 0.3s, -moz-transform 0.3s; transition: height 0.3s, opacity 0.3s, transform 0.3s; -webkit-transform: translateY(-10px); -moz-transform: translateY(-10px); transform: translateY(-10px); } .cl-effect-4 a:hover::after, .cl-effect-4 a:focus::after { height: 5px; opacity: 1; -webkit-transform: translateY(0px); -moz-transform: translateY(0px); transform: translateY(0px); } /* Effect 5: same word slide in */ .cl-effect-5 a { overflow: hidden; padding: 0 4px; height: 1em; } .cl-effect-5 a span { position: relative; display: inline-block; -webkit-transition: -webkit-transform 0.3s; -moz-transition: -moz-transform 0.3s; transition: transform 0.3s; } .cl-effect-5 a span::before { position: absolute; top: 100%; content: attr(data-hover); font-weight: 700; -webkit-transform: translate3d(0,0,0); -moz-transform: translate3d(0,0,0); transform: translate3d(0,0,0); } .cl-effect-5 a:hover span, .cl-effect-5 a:focus span { -webkit-transform: translateY(-100%); -moz-transform: translateY(-100%); transform: translateY(-100%); } /* Effect 5: same word slide in and border bottom */ .cl-effect-6 a { margin: 0 10px; padding: 10px 20px; } .cl-effect-6 a::before { position: absolute; top: 0; left: 0; width: 100%; height: 2px; background: #fff; content: ''; -webkit-transition: top 0.3s; -moz-transition: top 0.3s; transition: top 0.3s; } .cl-effect-6 a::after { position: absolute; top: 0; left: 0; width: 2px; height: 2px; background: #fff; content: ''; -webkit-transition: height 0.3s; -moz-transition: height 0.3s; transition: height 0.3s; } .cl-effect-6 a:hover::before { top: 100%; opacity: 1; } .cl-effect-6 a:hover::after { height: 100%; } /* Effect 7: second border slides up */ .cl-effect-7 a { padding: 12px 10px 10px; color: #566473; text-shadow: none; font-weight: 700; } .cl-effect-7 a::before, .cl-effect-7 a::after { position: absolute; top: 100%; left: 0; width: 100%; height: 3px; background: #566473; content: ''; -webkit-transition: -webkit-transform 0.3s; -moz-transition: -moz-transform 0.3s; transition: transform 0.3s; -webkit-transform: scale(0.85); -moz-transform: scale(0.85); transform: scale(0.85); } .cl-effect-7 a::after { opacity: 0; -webkit-transition: top 0.3s, opacity 0.3s, -webkit-transform 0.3s; -moz-transition: top 0.3s, opacity 0.3s, -moz-transform 0.3s; transition: top 0.3s, opacity 0.3s, transform 0.3s; } .cl-effect-7 a:hover::before, .cl-effect-7 a:hover::after, .cl-effect-7 a:focus::before, .cl-effect-7 a:focus::after { -webkit-transform: scale(1); -moz-transform: scale(1); transform: scale(1); } .cl-effect-7 a:hover::after, .cl-effect-7 a:focus::after { top: 0%; opacity: 1; } /* Effect 8: border slight translate */ .cl-effect-8 a { padding: 10px 20px; } .cl-effect-8 a::before, .cl-effect-8 a::after { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 3px solid #354856; content: ''; -webkit-transition: -webkit-transform 0.3s, opacity 0.3s; -moz-transition: -moz-transform 0.3s, opacity 0.3s; transition: transform 0.3s, opacity 0.3s; } .cl-effect-8 a::after { border-color: #fff; opacity: 0; -webkit-transform: translateY(-7px) translateX(6px); -moz-transform: translateY(-7px) translateX(6px); transform: translateY(-7px) translateX(6px); } .cl-effect-8 a:hover::before, .cl-effect-8 a:focus::before { opacity: 0; -webkit-transform: translateY(5px) translateX(-5px); -moz-transform: translateY(5px) translateX(-5px); transform: translateY(5px) translateX(-5px); } .cl-effect-8 a:hover::after, .cl-effect-8 a:focus::after { opacity: 1; -webkit-transform: translateY(0px) translateX(0px); -moz-transform: translateY(0px) translateX(0px); transform: translateY(0px) translateX(0px); } /* Effect 9: second text and borders */ .cl-effect-9 a { margin: 0 20px; padding: 18px 20px; } .cl-effect-9 a::before, .cl-effect-9 a::after { position: absolute; top: 0; left: 0; width: 100%; height: 1px; background: #fff; content: ''; opacity: 0.2; -webkit-transition: opacity 0.3s, height 0.3s; -moz-transition: opacity 0.3s, height 0.3s; transition: opacity 0.3s, height 0.3s; } .cl-effect-9 a::after { top: 100%; opacity: 0; -webkit-transition: -webkit-transform 0.3s, opacity 0.3s; -moz-transition: -moz-transform 0.3s, opacity 0.3s; transition: transform 0.3s, opacity 0.3s; -webkit-transform: translateY(-10px); -moz-transform: translateY(-10px); transform: translateY(-10px); } .cl-effect-9 a span:first-child { z-index: 2; display: block; font-weight: 300; } .cl-effect-9 a span:last-child { z-index: 1; display: block; padding: 8px 0 0 0; color: rgba(0,0,0,0.4); text-shadow: none; text-transform: none; font-style: italic; font-size: 0.75em; font-family: Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif; opacity: 0; -webkit-transition: -webkit-transform 0.3s, opacity 0.3s; -moz-transition: -moz-transform 0.3s, opacity 0.3s; transition: transform 0.3s, opacity 0.3s; -webkit-transform: translateY(-100%); -moz-transform: translateY(-100%); transform: translateY(-100%); } .cl-effect-9 a:hover::before, .cl-effect-9 a:focus::before { height: 6px; } .cl-effect-9 a:hover::before, .cl-effect-9 a:hover::after, .cl-effect-9 a:focus::before, .cl-effect-9 a:focus::after { opacity: 1; -webkit-transform: translateY(0px); -moz-transform: translateY(0px); transform: translateY(0px); } .cl-effect-9 a:hover span:last-child, .cl-effect-9 a:focus span:last-child { opacity: 1; -webkit-transform: translateY(0%); -moz-transform: translateY(0%); transform: translateY(0%); } /* Effect 10: reveal, push out */ .cl-effect-10 { position: relative; z-index: 1; } .cl-effect-10 a { overflow: hidden; margin: 0 15px; } .cl-effect-10 a span { display: block; padding: 10px 20px; background: #0f7c67; -webkit-transition: -webkit-transform 0.3s; -moz-transition: -moz-transform 0.3s; transition: transform 0.3s; } .cl-effect-10 a::before { position: absolute; top: 0; left: 0; z-index: -1; padding: 10px 20px; width: 100%; height: 100%; background: #fff; color: #0f7c67; content: attr(data-hover); -webkit-transition: -webkit-transform 0.3s; -moz-transition: -moz-transform 0.3s; transition: transform 0.3s; -webkit-transform: translateX(-25%); } .cl-effect-10 a:hover span, .cl-effect-10 a:focus span { -webkit-transform: translateX(100%); -moz-transform: translateX(100%); transform: translateX(100%); } .cl-effect-10 a:hover::before, .cl-effect-10 a:focus::before { -webkit-transform: translateX(0%); -moz-transform: translateX(0%); transform: translateX(0%); } /* Effect 11: text fill based on Lea Verou's animation http://dabblet.com/gist/6046779 */ .cl-effect-11 a { padding: 10px 0; border-top: 2px solid #0972b4; color: #0972b4; text-shadow: none; } .cl-effect-11 a::before { position: absolute; top: 0; left: 0; overflow: hidden; padding: 10px 0; max-width: 0; border-bottom: 2px solid #fff; color: #fff; content: attr(data-hover); -webkit-transition: max-width 0.5s; -moz-transition: max-width 0.5s; transition: max-width 0.5s; } .cl-effect-11 a:hover::before, .cl-effect-11 a:focus::before { max-width: 100%; } /* Effect 12: circle */ .cl-effect-12 a::before, .cl-effect-12 a::after { position: absolute; top: 50%; left: 50%; width: 100px; height: 100px; border: 2px solid rgba(0,0,0,0.1); border-radius: 50%; content: ''; opacity: 0; -webkit-transition: -webkit-transform 0.3s, opacity 0.3s; -moz-transition: -moz-transform 0.3s, opacity 0.3s; transition: transform 0.3s, opacity 0.3s; -webkit-transform: translateX(-50%) translateY(-50%) scale(0.2); -moz-transform: translateX(-50%) translateY(-50%) scale(0.2); transform: translateX(-50%) translateY(-50%) scale(0.2); } .cl-effect-12 a::after { width: 90px; height: 90px; border-width: 6px; -webkit-transform: translateX(-50%) translateY(-50%) scale(0.8); -moz-transform: translateX(-50%) translateY(-50%) scale(0.8); transform: translateX(-50%) translateY(-50%) scale(0.8); } .cl-effect-12 a:hover::before, .cl-effect-12 a:hover::after, .cl-effect-12 a:focus::before, .cl-effect-12 a:focus::after { opacity: 1; -webkit-transform: translateX(-50%) translateY(-50%) scale(1); -moz-transform: translateX(-50%) translateY(-50%) scale(1); transform: translateX(-50%) translateY(-50%) scale(1); } /* Effect 13: three circles */ .cl-effect-13 a { -webkit-transition: color 0.3s; -moz-transition: color 0.3s; transition: color 0.3s; } .cl-effect-13 a::before { position: absolute; top: 100%; left: 50%; color: transparent; content: '•'; text-shadow: 0 0 transparent; font-size: 1.2em; -webkit-transition: text-shadow 0.3s, color 0.3s; -moz-transition: text-shadow 0.3s, color 0.3s; transition: text-shadow 0.3s, color 0.3s; -webkit-transform: translateX(-50%); -moz-transform: translateX(-50%); transform: translateX(-50%); pointer-events: none; } .cl-effect-13 a:hover::before, .cl-effect-13 a:focus::before { color: #fff; text-shadow: 10px 0 #fff, -10px 0 #fff; } .cl-effect-13 a:hover, .cl-effect-13 a:focus { color: #ba7700; } /* Effect 14: border switch */ .cl-effect-14 a { padding: 0 20px; height: 45px; line-height: 45px; } .cl-effect-14 a::before, .cl-effect-14 a::after { position: absolute; width: 45px; height: 2px; background: #fff; content: ''; opacity: 0.2; -webkit-transition: all 0.3s; -moz-transition: all 0.3s; transition: all 0.3s; pointer-events: none; } .cl-effect-14 a::before { top: 0; left: 0; -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); transform: rotate(90deg); -webkit-transform-origin: 0 0; -moz-transform-origin: 0 0; transform-origin: 0 0; } .cl-effect-14 a::after { right: 0; bottom: 0; -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); transform: rotate(90deg); -webkit-transform-origin: 100% 0; -moz-transform-origin: 100% 0; transform-origin: 100% 0; } .cl-effect-14 a:hover::before, .cl-effect-14 a:hover::after, .cl-effect-14 a:focus::before, .cl-effect-14 a:focus::after { opacity: 1; } .cl-effect-14 a:hover::before, .cl-effect-14 a:focus::before { left: 50%; -webkit-transform: rotate(0deg) translateX(-50%); -moz-transform: rotate(0deg) translateX(-50%); transform: rotate(0deg) translateX(-50%); } .cl-effect-14 a:hover::after, .cl-effect-14 a:focus::after { right: 50%; -webkit-transform: rotate(0deg) translateX(50%); -moz-transform: rotate(0deg) translateX(50%); transform: rotate(0deg) translateX(50%); } /* Effect 15: scale down, reveal */ .cl-effect-15 a { color: rgba(0,0,0,0.2); font-weight: 700; text-shadow: none; } .cl-effect-15 a::before { color: #fff; content: attr(data-hover); position: absolute; -webkit-transition: -webkit-transform 0.3s, opacity 0.3s; -moz-transition: -moz-transform 0.3s, opacity 0.3s; transition: transform 0.3s, opacity 0.3s; } .cl-effect-15 a:hover::before, .cl-effect-15 a:focus::before { -webkit-transform: scale(0.9); -moz-transform: scale(0.9); transform: scale(0.9); opacity: 0; } /* Effect 16: fall down */ .cl-effect-16 a { color: #6f8686; text-shadow: 0 0 1px rgba(111,134,134,0.3); } .cl-effect-16 a::before { color: #fff; content: attr(data-hover); position: absolute; opacity: 0; text-shadow: 0 0 1px rgba(255,255,255,0.3); -webkit-transform: scale(1.1) translateX(10px) translateY(-10px) rotate(4deg); -moz-transform: scale(1.1) translateX(10px) translateY(-10px) rotate(4deg); transform: scale(1.1) translateX(10px) translateY(-10px) rotate(4deg); -webkit-transition: -webkit-transform 0.3s, opacity 0.3s; -moz-transition: -moz-transform 0.3s, opacity 0.3s; transition: transform 0.3s, opacity 0.3s; pointer-events: none; } .cl-effect-16 a:hover::before, .cl-effect-16 a:focus::before { -webkit-transform: scale(1) translateX(0px) translateY(0px) rotate(0deg); -moz-transform: scale(1) translateX(0px) translateY(0px) rotate(0deg); transform: scale(1) translateX(0px) translateY(0px) rotate(0deg); opacity: 1; } /* Effect 17: move up fade out, push border */ .cl-effect-17 a { color: #10649b; text-shadow: none; padding: 10px 0; } .cl-effect-17 a::before { color: #fff; text-shadow: 0 0 1px rgba(255,255,255,0.3); content: attr(data-hover); position: absolute; -webkit-transition: -webkit-transform 0.3s, opacity 0.3s; -moz-transition: -moz-transform 0.3s, opacity 0.3s; transition: transform 0.3s, opacity 0.3s; pointer-events: none; } .cl-effect-17 a::after { content: ''; position: absolute; left: 0; bottom: 0; width: 100%; height: 2px; background: #fff; opacity: 0; -webkit-transform: translateY(5px); -moz-transform: translateY(5px); transform: translateY(5px); -webkit-transition: -webkit-transform 0.3s, opacity 0.3s; -moz-transition: -moz-transform 0.3s, opacity 0.3s; transition: transform 0.3s, opacity 0.3s; pointer-events: none; } .cl-effect-17 a:hover::before, .cl-effect-17 a:focus::before { opacity: 0; -webkit-transform: translateY(-2px); -moz-transform: translateY(-2px); transform: translateY(-2px); } .cl-effect-17 a:hover::after, .cl-effect-17 a:focus::after { opacity: 1; -webkit-transform: translateY(0px); -moz-transform: translateY(0px); transform: translateY(0px); } /* Effect 18: cross */ .cl-effect-18 { position: relative; z-index: 1; } .cl-effect-18 a { padding: 0 5px; color: #b4770d; font-weight: 700; -webkit-transition: color 0.3s; -moz-transition: color 0.3s; transition: color 0.3s; } .cl-effect-18 a::before, .cl-effect-18 a::after { position: absolute; width: 100%; left: 0; top: 50%; height: 2px; margin-top: -1px; background: #b4770d; content: ''; z-index: -1; -webkit-transition: -webkit-transform 0.3s, opacity 0.3s; -moz-transition: -moz-transform 0.3s, opacity 0.3s; transition: transform 0.3s, opacity 0.3s; pointer-events: none; } .cl-effect-18 a::before { -webkit-transform: translateY(-20px); -moz-transform: translateY(-20px); transform: translateY(-20px); } .cl-effect-18 a::after { -webkit-transform: translateY(20px); -moz-transform: translateY(20px); transform: translateY(20px); } .cl-effect-18 a:hover, .cl-effect-18 a:focus { color: #fff; } .cl-effect-18 a:hover::before, .cl-effect-18 a:hover::after, .cl-effect-18 a:focus::before, .cl-effect-18 a:focus::after { opacity: 0.7; } .cl-effect-18 a:hover::before, .cl-effect-18 a:focus::before { -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); transform: rotate(45deg); } .cl-effect-18 a:hover::after, .cl-effect-18 a:focus::after { -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); transform: rotate(-45deg); } /* Effect 19: 3D side */ .cl-effect-19 a { line-height: 2em; margin: 15px; -webkit-perspective: 800px; -moz-perspective: 800px; perspective: 800px; width: 200px; } .cl-effect-19 a span { position: relative; display: inline-block; width: 100%; padding: 0 14px; background: #e35041; -webkit-transition: -webkit-transform 0.4s, background 0.4s; -moz-transition: -moz-transform 0.4s, background 0.4s; transition: transform 0.4s, background 0.4s; -webkit-transform-style: preserve-3d; -moz-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-transform-origin: 50% 50% -100px; -moz-transform-origin: 50% 50% -100px; transform-origin: 50% 50% -100px; } .csstransforms3d .cl-effect-19 a span::before { position: absolute; top: 0; left: 100%; width: 100%; height: 100%; background: #b53a2d; content: attr(data-hover); -webkit-transition: background 0.4s; -moz-transition: background 0.4s; transition: background 0.4s; -webkit-transform: rotateY(90deg); -moz-transform: rotateY(90deg); transform: rotateY(90deg); -webkit-transform-origin: 0 50%; -moz-transform-origin: 0 50%; transform-origin: 0 50%; pointer-events: none; } .cl-effect-19 a:hover span, .cl-effect-19 a:focus span { background: #b53a2d; -webkit-transform: rotateY(-90deg); -moz-transform: rotateY(-90deg); transform: rotateY(-90deg); } .csstransforms3d .cl-effect-19 a:hover span::before, .csstransforms3d .cl-effect-19 a:focus span::before { background: #ef5e50; } /* Effect 20: 3D side */ .cl-effect-20 a { line-height: 2em; -webkit-perspective: 800px; -moz-perspective: 800px; perspective: 800px; } .cl-effect-20 a span { position: relative; display: inline-block; padding: 3px 15px 0; background: #587285; box-shadow: inset 0 3px #2f4351; -webkit-transition: background 0.6s; -moz-transition: background 0.6s; transition: background 0.6s; -webkit-transform-origin: 50% 0; -moz-transform-origin: 50% 0; transform-origin: 50% 0; -webkit-transform-style: preserve-3d; -moz-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-transform-origin: 0% 50%; -moz-transform-origin: 0% 50%; transform-origin: 0% 50%; } .cl-effect-20 a span::before { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #fff; color: #2f4351; content: attr(data-hover); -webkit-transform: rotateX(270deg); -moz-transform: rotateX(270deg); transform: rotateX(270deg); -webkit-transition: -webkit-transform 0.6s; -moz-transition: -moz-transform 0.6s; transition: transform 0.6s; -webkit-transform-origin: 0 0; -moz-transform-origin: 0 0; transform-origin: 0 0; pointer-events: none; } .cl-effect-20 a:hover span, .cl-effect-20 a:focus span { background: #2f4351; } .cl-effect-20 a:hover span::before, .cl-effect-20 a:focus span::before { -webkit-transform: rotateX(10deg); -moz-transform: rotateX(10deg); transform: rotateX(10deg); } /* Effect 21: borders slight translate */ .cl-effect-21 a { padding: 10px; color: #237546; font-weight: 700; text-shadow: none; -webkit-transition: color 0.3s; -moz-transition: color 0.3s; transition: color 0.3s; } .cl-effect-21 a::before, .cl-effect-21 a::after { position: absolute; left: 0; width: 100%; height: 2px; background: #fff; content: ''; opacity: 0; -webkit-transition: opacity 0.3s, -webkit-transform 0.3s; -moz-transition: opacity 0.3s, -moz-transform 0.3s; transition: opacity 0.3s, transform 0.3s; -webkit-transform: translateY(-10px); -moz-transform: translateY(-10px); transform: translateY(-10px); } .cl-effect-21 a::before { top: 0; -webkit-transform: translateY(-10px); -moz-transform: translateY(-10px); transform: translateY(-10px); } .cl-effect-21 a::after { bottom: 0; -webkit-transform: translateY(10px); -moz-transform: translateY(10px); transform: translateY(10px); } .cl-effect-21 a:hover, .cl-effect-21 a:focus { color: #fff; } .cl-effect-21 a:hover::before, .cl-effect-21 a:focus::before, .cl-effect-21 a:hover::after, .cl-effect-21 a:focus::after { opacity: 1; -webkit-transform: translateY(0px); -moz-transform: translateY(0px); transform: translateY(0px); } |
For its application there are three ways. Some cases of application in your html can use syntax as follows:
1 2 3 4 5 6 7 |
<nav class="cl-effect-1"> <a href="#">Wafture</a> <a href="#">Sumptuous</a> <a href="#">Scintilla</a> <a href="#">Propinquity</a> <a href="#">Harbinger</a> </nav> |
For the case of special effects, you must add attributes to the link by adding data-hover, see examples:
1 2 3 4 5 6 7 |
<nav class="cl-effect-2"> <a href="#"><span data-hover="Ratatouille">Ratatouille</span></a> <a href="#"><span data-hover="Lassitude">Lassitude</span></a> <a href="#"><span data-hover="Murmurous">Murmurous</span></a> <a href="#"><span data-hover="Palimpsest">Palimpsest</span></a> <a href="#"><span data-hover="Assemblage">Assemblage</span></a> </nav> |
Then for some cases you also have to add a span because we will add perspective to each link to get another special link effect. See an example:
1 2 3 4 5 6 7 |
<nav class="cl-effect-10"> <a href="#" data-hover="Seraglio"><span>Seraglio</span></a> <a href="#" data-hover="Sumptuous"><span>Sumptuous</span></a> <a href="#" data-hover="Scintilla"><span>Scintilla</span></a> <a href="#" data-hover="Palimpsest"><span>Palimpsest</span></a> <a href="#" data-hover="Assemblage"><span>Assemblage</span></a> </nav> |
Sorry, not all examples of the effect link I show. But you can see a demo and download the source code for this project below. I hope this can be an inspiration to boast modern effect links with CSS3.
[the_ad id=”632″]
Alhamdulillah, finally we also finished making an article about: Adding Modern Link Effect with CSS3. Hopefully this article can be useful for all of us. If you have questions, don’t be shy about asking in the comments column. Happy coding … 🙂