Css кнопка привлекающая внимание

10 Best CSS button hover effects

I bet the last time you created a CSS hover effect for a button on your site, you flipped the colour of the text with the colour of the background and used a transition of somewhere between 0.3 and 0.5 seconds.

Am I right? Do you feel seen?

Or perhaps you google a bit and found a list of cool CSS animations to add to your website and picked a couple of them, right?

Even if not, would you agree that this is the most common way to create CSS hover animations for buttons? I’m not knocking it — I’ve done it many times myself. It works.

But. there are plenty of other ways you can animate your buttons with CSS, which could make your site more fun and help it stand out from the crowd.

So let’s explore some other options!

CSS button gradient effects

At the time I’m writing this, you can’t animate gradients with CSS — at least, not directly. There is, however, a way to trick CSS into doing what we want — we just make the background larger than the button, and move the background on hover. The result is an animated gradient effect on your buttons.

Here are a few examples — you can take one of these and change the gradient colours and angle if you want:

You can also create an animated gradient effect around the border, instead of the background. Or both:

CSS button hover effects using box shadow

Remember when you were a kid, and you drew a rectangle, then you added a little shading around two edges to make it look kinda 3D? Well CSS box-shadow does that:

But, box-shadow gives us a lot of control of how the shadow appears:

  • How big should the shadow be?
  • How far from the box?
  • What colour?
  • Multiple shadows, or just one?
  • Inside the box, or outside?
  • Solid shadow, or blurry?

And, we can animate all of this! Here are some creative ideas on how you can use box-shadow in your button hover effects:

Check out Mozilla’s article on box-shadow to learn more.

Expanding CSS button hover effect

Here’s a unique hover effect that might be useful to you:

It looks like a text link with a little icon next to it, but looks can be deceiving — the whole thing is actually the button. When you hover, the icon expands and spreads over the text. Very nice!

Читайте также:  JS In HTML

CSS button on hover fill effects

As I said earlier, the most common button hover effect has to be a simple fill — simply flipping the background colour and the text colour, usually with a fade-in of half a second or so. To be fair, there’s a reason this is common — it does the job and does it well. But that doesn’t mean you can’t get creative with it.

There are lots of ways you can do create the fill effect besides a fade. You could have the background spread out from the centre, slide it in from the side, or spin it around and lock it into place, just to name three. Here are a few ways you could mix it up a bit:

If you like beautifying elements like buttons, you will for sure like turning checkboxes into beautiful toggle switch elements. Check out the best examples we’ve found on CSS toggle switches.

3D rotating button effect on hover with CSS only

You might have seen these 3D rotating buttons before. This one is particularly cool because it’s done purely in CSS, and because it has two «cubes» that rotate in different directions (although you could just get rid of the second one if you don’t want it).

Note that you’ll need to change the data-attr and the text within the span to change the text shown.

Apple style swipe effect on hover

These buttons visually mimic the effect on iOS when you swipe a menu item (e.g., a note in your Notes app) to make the buttons appear. Here though, it’s just a visual effect — you don’t have to click on the green bit that slides in, you can click any part of it:

The cool thing about these is you can give the visitor an additional call to action (though personally, I’d have used red instead of green for the cancel button).

CSS Button hover background change

OK, time to think outside the box.

I mean that literally — why not have our CSS button’s hover effect change something other than the actual button itself? Like the background, maybe?

This is one of those cool ideas that’s good to have in your back pocket for future use.

Hidden door CSS button effect

Oh! look, a Twitter icon. I guess I just click this and it takes me to the user’s twitter page. Like the 10 zillions other Twitter buttons I’ve seen in my life.

Oh well, might as well click it:

Woah! Is it a Twitter button, or the entrance to a shuttle bay on the Starship Enterprise?

Although there is some JS in the Pen, that’s just to import the Twitter link, in this case to creator Tim Holman’s Twitter link. The JS doesn’t have any effect on how the button works — and of course you don’t have to use it for Twitter — you can adapt it for anything.

Читайте также:  Async Tree - jQuery EasyUI Demo

Animated Pac-Man CSS button on hover

Here’s an incredible piece of work by Dario Corsi. Check it out:

There’s so much to appreciate about this:

  • It’s pure CSS — not an image or line of JS insight
  • Of all the ghosts, Dario chose Blinky, the leader of the ghosts and Pac-Man’s arch enemy
  • Blinky’s eyes look in the direction he’s moving!
  • The animation stops in-place when you stop hovering, rather than resetting to the beginning

A true 3D button animation using three.js

This one isn’t pure CSS, but I thought I’d include this to show you the type of things that are possible when bringing JS into the picture. This is a «true» 3D hover effect button by Robin Delaporte:

Look at that! If you move your mouse around the button area, the shapes react to your mouse movements.

Now, when I say «true» 3D, obviously it’s not actually 3D since it’s a flat image on your screen! I just mean that there’s a Z-axis involved. These are not simply 2D objects at different depths, moving at different rates (as is the case with parallax ). The angle and position of the object along the Z-axis are calculated in JS. This means you can move or rotate it along the third dimension, and add lighting effects to really bring it to life.

To do this, Robin has used a JS library called three.js — a very popular library for making 3D animations on the web, and it’s actually fairly easy to get started with. Of course, you’ll need some practice to create something like this, but if you really study it, you can make some amazing stuff.

Speaking of easy-to-use JS libraries that help you make great stuff, you might also like fullPage.js. fullPage helps you make gorgeous one-page sites quickly and easily, and it works like a charm alongside WordPress, React, and Vue.

We’ve been talking a lot about using animations to improve the visual appeal of your site in this post, and if you’re into this sort of thing have a look at the effects you can use with fullPage. You can use different effects as you scroll from one full-screen page to the next (the card effect is pretty snazzy for instance), or in sliders. All of this is built-in and works out of the box.

And of course, you can integrate all of the awesome CSS button hover effects we’ve just looked at into your fullPage.js site! In fact, the background image change button could work really well on a full-page site — give fullPage.js a try and see what you can come up with!

Источник

Css кнопка привлекающая внимание

Долго искал с дизайнером способ повысить конверсию с формы на одном лендинге. Что-то такое — не раздражающее, но в то же время привлекающее внимание.
Решение оказалось простым и конверсия действительно повысилась на 3%. Ниже код на чистом HTML/CSS.

.preview-block__btn < max-width: 350px; margin-top: 35px; >.custom-btn < display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-orient: horizontal; -webkit-box-direction: normal; -ms-flex-flow: row nowrap; flex-flow: row nowrap; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; width: 100%; height: 58px; padding-top: 2px; border: none; border-bottom: 2px solid #beb038; position: relative; font-size: 15px; font-weight: bold; color: #000; text-align: center; text-transform: uppercase; cursor: pointer; overflow: hidden; background: #f3d429; -webkit-transition: ease 0.3s; transition: ease 0.3s; >.custom-btn:after < content: ""; display: block; width: 30px; height: 300px; margin-left: 60px; background: #fff; background: -moz-linear-gradient(top, rgba(255,255,255,0.7) 0%, rgba(255,255,255,1) 50%, rgba(255,255,255,0.7) 100%); background: -webkit-linear-gradient(top, rgba(255,255,255,0.7) 0%,rgba(255,255,255,1) 50%,rgba(255,255,255,0.7) 100%); background: linear-gradient(to bottom, rgba(255,255,255,0.7) 0%,rgba(255,255,255,1) 50%,rgba(255,255,255,0.7) 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b3ffffff', endColorstr='#b3ffffff',GradientType=0 ); position: absolute; left: -40px; top: -150px; z-index: 1; -webkit-transform: rotate(45deg); transform: rotate(45deg); -webkit-transition: all 0.1s; transition: all 0.1s; -webkit-animation-name: slideme; animation-name: slideme; -webkit-animation-duration: 3s; animation-duration: 3s; -webkit-animation-delay: 0.05s; animation-delay: 0.05s; -webkit-animation-timing-function: ease-in-out; animation-timing-function: ease-in-out; -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; >@-webkit-keyframes slideme < 0% < left: -30px; margin-left: 0px; >30% < left: 110%; margin-left: 80px; >100% < left: 110%; margin-left: 80px; >>

Источник

Читайте также:  Передать post запрос php curl

Анимированный блик на чистом CSS

Приветствую, друзья, сегодня покажу как сделать анимированный блик на кнопке. Использовать для этого мы будем только чистый CSS. Без использования плагинов и библиотек. Наш анимированный блик будет похож на тот, что используют в тильде.

Эффект анимированного блика часто используется для привлечения внимания пользователя. Как только пользователь зайдет на сайт, он сразу увидит кнопку с анимированным бликом. Так же из-за приятной анимации повышается конверсия.

Как всегда, вы можете посмотреть пример блика на кнопке и готовый код для него на codepen .

Анимированный блик на кнопке — HTML часть

Саму кнопку вы можете стилизовать как хотите, тут только мой пример. Важное, что вам нужно сделать — добавить для самой кнопки свойство overflow-x: hidden и position: relative . Это нужно, что бы скрыть блик, когда он не на кнопке и правильно позиционировать его относительно её.

Код самого блика лучше скопируйте, и попробуйте изменять параметры, что бы увидеть на практике, как именно все работает. В коде я оставлю комментарии, какое свойство за что отвечает.

.button < padding: 20px 80px; background: #3E64FF; color: #ffffff; text-decoration: none; font-size: 24px; font-weight: 600; border-radius: 10px; position: relative; // Это важно добавить overflow-x: hidden; / Это важно добавить >.button .flare < position: absolute; top: 0; height: 100%; width: 45px; transform: skewX(-45deg); // Наклон animation: flareAnimation; left: -150%; background: linear-gradient(90deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.4)); animation: flareAnimation 3s infinite linear; // Время и тип анимации можно менять >@keyframes flareAnimation < 0% < left: -150%; >100% < left: 150%; >>

Результат

Спасибо, что прочитали! Если у вас остались любые вопросы — задавайте их на Youtube, или пишите мне в Telegram, с радостью вам помогу и отвечу на вопросы.

Full Stack разработчик, Frontend: Vue.js (2,3) + VueX + Vue Router, Backend: Node.js + Express.js. Раньше работал с РНР, WordPress, написал несколько проектов на Laravel. Люблю помогать людям изучать что-то новое)

Источник

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