Utvikling · verktøy

CSS-generator for boksskygge

Juster skyggeverdiene og kopier CSS-deklarasjonen til stilarket ditt.

Kjøres i nettleseren. Ingen opplasting.

Values are processed locally in this browser.

Result

—

Om verktøyet

CSS-generator for boksskygge sem complicação.

Generatoren lager én skyggeerklæring. Forhåndsvis den i ditt eget oppsett, og kontroller synlighet, kontrast og behov for redusert bevegelse eller høy kontrast.

Veiledning

Slik bruker du CSS-generator for boksskygge

The CSS Box Shadow Generator writes one box-shadow line for you to paste into a stylesheet. You set the horizontal and vertical offset, blur, spread, colour, opacity and whether the shadow is outside or inset. The colour and opacity are combined into an rgba value. It makes a single shadow only, and it shows no live preview, so you check how it looks in your own page.

Slik gjør du

  1. Enter the horizontal and vertical offsets, blur and spread, all in pixels. Negative offsets move the shadow left or up.
  2. Type the shadow colour as a hex code, with three or six digits, and set the opacity from 0 to 100 percent.
  3. Choose Outside for a normal shadow or Inset to draw it inside the box.
  4. Press Calculate and copy the line from the Result box. Paste it into a rule, such as .card { ... }.

Eksempler

A soft shadow under a card

Du skriver inn
Horisontalt avvik
0
Vertikalt avvik
8
Uskarphet
24
Spredning
0
Farge
#000000
Opasitet
18
Plassering
Outside
Du får
CSS
box-shadow: 0px 8px 24px 0px rgba(0, 0, 0, 0.18);

Black at 18 percent opacity becomes the alpha value 0.18. The shadow sits 8 pixels below the box and is blurred over 24 pixels.

Kjørt med verktøyets egen kode.

An inset shadow with a short colour code

Du skriver inn
Horisontalt avvik
2
Vertikalt avvik
-3
Uskarphet
6
Spredning
1
Farge
#36c
Opasitet
50
Plassering
Inset
Du får
CSS
box-shadow: inset 2px -3px 6px 1px rgba(51, 102, 204, 0.5);

The short code #36c is read as #3366cc, which is 51, 102, 204. The word inset comes first, and the shadow is drawn inside the box.

Kjørt med verktøyets egen kode.

A hard ring with no blur

Du skriver inn
Horisontalt avvik
0
Vertikalt avvik
0
Uskarphet
0
Spredning
4
Farge
ff8800
Opasitet
33
Plassering
Outside
Du får
CSS
box-shadow: 0px 0px 0px 4px rgba(255, 136, 0, 0.33);

With zero offset and blur, a spread of 4 pixels draws a sharp ring around the box. The leading # on the colour is optional.

Kjørt med verktøyets egen kode.

A colour name is not accepted

Du skriver inn
Horisontalt avvik
0
Vertikalt avvik
8
Uskarphet
24
Spredning
0
Farge
red
Opasitet
18
Plassering
Outside
Du får
Melding
Shadow color must be a 3- or 6-digit hex color, such as #336699.

Only hex codes work. A name like red, or a code with eight digits, is refused, and no line is produced.

Kjørt med verktøyets egen kode.

Når det er nyttig

  • Create a soft card shadow for a web page or a design system.
  • Add a pressed-button look with an inset shadow.
  • Draw a sharp outline ring around an input field using spread alone.
  • Turn a design file's shadow numbers into a ready-to-paste CSS line.

Begrensninger

  • Offsets must stay within 100 pixels in either direction, blur from 0 to 200 pixels and spread within 100 pixels either way. Opacity runs from 0 to 100 percent.
  • The colour must be a 3 or 6 digit hex code. Colour names, rgb(), hsl() and eight-digit hex with built-in alpha are not accepted.
  • It writes one shadow only. Stacked shadows, which are separated by commas in CSS, need to be joined by hand.
  • There is no live preview in the tool, and it cannot judge contrast, visibility or how the shadow looks in high-contrast or reduced-effects settings.

Tips

  • Use a low opacity with a large blur for a natural, soft shadow and a higher opacity with little blur for a crisp one.
  • Paste the line into your page and look at it on both light and dark backgrounds, as shadows read differently on each.
  • Do not rely on a shadow alone to mark a boundary or a focus state, since some people cannot see it.

Kilder

Vanlige spørsmål

Sobre CSS-generator for boksskygge.

What do the four numbers in box-shadow mean?

In order they are the horizontal offset, the vertical offset, the blur radius and the spread radius. Positive horizontal moves the shadow right and positive vertical moves it down. Blur softens the edge, and spread makes the shadow bigger or smaller than the box.

What does inset do?

Inset draws the shadow inside the box instead of behind it, which can make an element look pressed in. The tool adds the word inset at the start of the line when you pick it. Outside leaves it out and gives a normal shadow.

Why does the tool use rgba and not my hex code?

The opacity box needs a way to carry transparency, so the tool converts your hex colour into red, green and blue numbers and adds the opacity as the alpha value. The shadow looks the same, only written in another form.

Can I make more than one shadow?

Not in this tool, which writes one shadow per run. In CSS you can list several shadows in one box-shadow value, separated by commas. Make each one here, then join them with commas by hand.

Why is there no preview box?

The tool returns only the text of the CSS line. Add it to a test page or your browser's developer tools to see it on the real element. This also shows how it looks next to your own colours and spacing.

Why do I get an error for a value I think is fine?

Check the limits. Offsets and spread must be within 100 pixels, blur between 0 and 200, opacity between 0 and 100, and the colour a 3 or 6 digit hex code. Any empty box or non-number also gives an error.

Is anything sent to a server?

No. The line is built from your numbers by code running in your browser tab, and the values you type are not uploaded. The result only goes to your clipboard if you press Copy result.

Hvordan bruker du CSS-boksskyggegenerator?

Juster skyggeverdiene og kopier CSS-deklarasjonen til stilarket ditt.

Lastes dataene mine opp til en server?

Nei. Behandlingen skjer i nettleseren din, og opplysningene dine lastes ikke opp.