Gratis å bruke, uten konto

CSS-verktøy for hjørneradius

Lag en CSS-erklæring for border-radius med fire uavhengige hjørner, elliptiske horisontale og vertikale verdier eller én felles radius. Forhåndsvis mens du redigerer.

Horisontale radier

Vertikale radier

Verdiene kan overlappe. CSS-nettlesere normaliserer hjørneradier proporsjonalt ved behov; de genererte verdiene endres ikke i det skjulte.

Forhåndsvisningen er 320 × 180 px. Prosentverdier regnes ut fra elementets bredde og høyde.

Direkte forhåndsvisning

Hvordan lager jeg CSS for elliptisk border-radius?

Velg piksler eller prosent, oppgi fire horisontale og fire vertikale hjørneverdier, og kopier den genererte deklarasjonen. Når de horisontale og vertikale verdiene er like, brukes den kortere CSS-forkortelsen.

Veiledning

Slik bruker du CSS-verktøy for hjørneradius

This tool writes a CSS border-radius rule for you. You type a horizontal and a vertical radius for each of the four corners, in pixels or percent, and a sample box on the page changes shape as you type. When the values differ it writes the elliptical form with a slash, and you can copy the rule or download it as a small CSS file. It does not read your existing stylesheet.

Slik gjør du

  1. Choose Pixels or Percent in the unit list. Pixel values go from 0 to 500, and percent values go from 0 to 100.
  2. Type a horizontal radius and a vertical radius for the top left, top right, bottom right and bottom left corners. Tick the link box if you want every corner to copy the top left values.
  3. Watch the preview box, which is 320 by 180 pixels, and read the rule in the CSS declaration box. Press Load example for a ready-made uneven shape or Reset to go back to the start.
  4. Press Copy CSS to put the rule on your clipboard, or Download CSS to save it as a file named border-radius.css.

Eksempler

Uneven elliptical corners

Du skriver inn
Enhet
px
Horisontal radius
32; 100; 20; 64
Vertikal radius
22; 40; 70; 26
Du får
CSS
.shape { border-radius: 32px 100px 20px 64px / 22px 40px 70px 26px; }

The numbers before the slash are the horizontal radii and the numbers after it are the vertical radii. Both lists run clockwise from the top left corner. This is the same shape the Load example button creates.

Kjørt med verktøyets egen kode.

A pill or a circle from percent

Du skriver inn
Enhet
%
Horisontal radius
50; 50; 50; 50
Vertikal radius
50; 50; 50; 50
Du får
CSS
.shape { border-radius: 50% 50% 50% 50%; }

When the horizontal and vertical lists match, the slash part is left out. A radius of 50% on every corner turns a square into a circle, and the same rule turns a rectangle into an ellipse.

Kjørt med verktøyets egen kode.

A value that is out of range

Du skriver inn
Enhet
%
Øvre venstre horisontale radius
101
Du får
Resultat
no CSS is produced and an invalid-value message appears

Percent values above 100, pixel values above 500 and negative values are refused. The output box is cleared and the preview goes back to square corners until the number is fixed.

Kjørt med verktøyets egen kode.

Når det er nyttig

  • Build a blob or leaf shape for a card, avatar or button without guessing the numbers.
  • Learn how the slash form of border-radius splits horizontal and vertical radii.
  • Make one corner sharp and the others rounded for a tab or a speech bubble.
  • Get a clean rule to paste into a stylesheet, then rename the .shape class.

Begrensninger

  • Each radius is limited to 500 px or 100 percent, and the preview box is a fixed 320 by 180 px, so a real element of another size may look different.
  • Changing the unit does not convert the numbers. A value of 50 stays 50, so switching from px to percent changes the shape.
  • If radii on one side add up to more than the box allows, browsers shrink them proportionally. The tool still prints exactly what you typed.
  • A blank number box is read as 0, so check that every field has the value you meant.

Tips

  • Start with the percent unit when the shape should scale with the element, and use pixels for small fixed corners.
  • Type a very large pixel value on all corners to see the browser's shrinking rule in the preview.
  • Remember to change the .shape selector in the copied rule to your own class name.

Kilder

Vanlige spørsmål

How do I make elliptical corners with border-radius?

Give a horizontal and a vertical radius that differ. The tool writes the horizontal values first, then a slash, then the vertical values. A corner whose two values differ is curved like part of an ellipse rather than a circle.

In what order are the four corners written?

They go clockwise, starting at the top left, then the top right, the bottom right and the bottom left. The tool always writes all four values for each side of the slash, even when some are equal.

What do percent values refer to?

Horizontal percentages are relative to the element's width and vertical ones to its height. That is why 50 percent on each corner gives a circle on a square and an ellipse on a rectangle.

Why does the shape look different from my numbers?

When two radii along one edge add up to more than the edge's length, browsers scale all the radii down together. The preview shows that effect, while the generated rule keeps the numbers you entered unchanged.

Is anything uploaded or saved?

No. The preview and the CSS are built in your browser and nothing is sent to a server. The tool does not store your values, so reloading the page returns it to the starting shape.

Can I paste the result straight into my site?

Yes, but the rule is written for a class called shape. Change the selector to the class of your element, and test the result in the browsers you support, since the effect depends on the element's final size.

Hvordan lager jeg CSS for elliptisk border-radius?

Velg piksler eller prosent, oppgi fire horisontale og fire vertikale hjørneverdier, og kopier den genererte deklarasjonen. Når de horisontale og vertikale verdiene er like, brukes den kortere CSS-forkortelsen.

Lastes CSS-en min opp?

Nei. Forhåndsvisningen og CSS-en lages i nettleseren. Ingenting lastes opp eller lagres av verktøyet.

Kan hvert hjørne ha ulik radius?

Ja. Angi en egen horisontal radius for hvert hjørne, og legg til egne vertikale verdier for elliptiske hjørner.

Hvorfor endrer nettleseren overlappende hjørneradier?

CSS reduserer overlappende radier proporsjonalt slik at de får plass i elementet. Dette verktøyet beholder CSS-verdiene du har bedt om, og forklarer nettleserens oppførsel i stedet for å skjule den.

Hva brukes som referanse for prosentverdier for border-radius?

Horisontale prosentverdier regnes ut fra elementets bredde, mens vertikale prosentverdier regnes ut fra høyden.