简体   繁体   English

如何模糊按钮的轮廓?

[英]How to blur the outline of button?

I am trying to blur the outline of a button without blurring the inside image.我试图在不模糊内部图像的情况下模糊按钮的轮廓。 The blur filter only applies to the whole image, but I only want the blue outline to be blurred.模糊滤镜仅适用于整个图像,但我只希望蓝色轮廓模糊。 basically apply the filter: blur(4px) but only on the outline基本上应用 filter: blur(4px) 但只在轮廓上

 button:focus {
  outline-color: #054EBA;
  outline-width: 2px;
  outline-offset: 5px;
}

What I have What I want我有什么我想要什么

You need to dispatch the blur effect to another container, it can be pseudo container.您需要将模糊效果发送到另一个容器,它可以是伪容器。

example例子

 button { position: relative; margin: 3em; padding: 0em 0.35em; color: white; background: #000; border-radius: 50%; border: none; font-size:2em; } button:focus:after { content: ''; position: absolute; top: -10px; bottom: -10px; left: -10px; right: -10px; pointer-events: none; border: solid #054eba 2px; filter: blur(2px); }
 <button>?</button>

Select only the button and not the image inside Select 只有按钮而不是里面的图像

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM