-1

My goal is to make the icon glow, but if apply shadow it comes with a ugly rounded div.

React code :

<SunIcon
  className="h-10 w-10 rounded-3xl mr-2.5 text-suncolor shadow-sunshadow"
     />

The sunshadow is 0 0 20px 7px rgb(255 204 51 / 66%)

Output i get: I get that outline

enter image description here

I also tried using outline none, but doesn't work

Sai Krishnadas
  • 2,863
  • 9
  • 36
  • 69
  • Which icon library are you using? – Dean James May 30 '21 at 08:27
  • Questions seeking code help must include the shortest code necessary to reproduce it **in the question itself** preferably in a [**Stack Snippet**](https://blog.stackoverflow.com/2014/09/introducing-runnable-javascript-css-and-html-code-snippets/). See [**How to create a Minimal, Reproducible Example**](http://stackoverflow.com/help/reprex) – Paulie_D May 30 '21 at 08:58

2 Answers2

2

I'm taking a guess that the icon library you're using is rendering SVG elements. Using box-shadow on an SVG results in the effect in the image you posted.

SVG can display shadows, which you can read about here, but when using a preexisting library, modifying them can be difficult.

For a CSS-driven shadow, you could use drop-shadow in a filter, however I have always found the effect to be too faded:

filter: drop-shadow( 0 0 5px rgba(255, 204, 51, .66));

Be aware that drop-shadow has limited browser compatibility.

Dean James
  • 2,491
  • 4
  • 21
  • 29
0

Elements are always Squares and rectangles (or with a radius, even a circle) but never custom shapes

Try it with a ::before pseudo element

.iconClassName::before, .iconClassName::before:hover, .iconClassName::before:active { content:"";  box-shadow: 0 0 20px 7px rgb(255 204 51 / 66%)}

Maybe you have to edit width/height, position...

Try to remove your Border-Radius, but without minimal example code it is hard to try

user966660
  • 634
  • 1
  • 8
  • 20