Information about cookies on this page

Our website uses cookies to ensure the functionality of the website, to collect and analyze information about the performance and usage of the website. Privacy Policy

  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in
  
  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in

Rounded Corners

Rounded corners are made with the border-radius property, as you know from the CSS course. In Tailwind, they are the rounded-* classes:

ClassCSSPixels
rounded-xsborder-radius: 0.125rem;2
rounded-smborder-radius: 0.25rem;4
rounded-mdborder-radius: 0.375rem;6
rounded-lgborder-radius: 0.5rem;8
rounded-xlborder-radius: 0.75rem;12
rounded-2xlborder-radius: 1rem;16
rounded-3xlborder-radius: 1.5rem;24
rounded-fullborder-radius: calc(infinity * 1px);infinitely many
rounded-noneborder-radius: 0;0

You know the size names from the font sizes and the max widths: from extra small (xs) through medium (md) to extra large (xl, 2xl, 3xl). Careful with older examples on the internet, written for Tailwind 3: some names have shifted since. There, rounded-sm was only 2 pixels, like today's rounded-xs.

rounded-full is special: the radius is so large that the shorter sides of the element turn into half circles. A button becomes a pill, and a square, such as a picture with size-16, a circle. In the CSS course, you made a circle with border-radius: 50%, but on a rectangle, 50% gives an ellipse, not a pill:

rounded-full border-radius: 50%

You can also round only some corners: rounded-t-2xl rounds the top two (t for top, as with borders), rounded-l-lg the left two, and rounded-tl-lg only the top left one.

Instructions

  1. 1

    Add the class rounded-2xl to Oscar's card.

  2. 2

    Add the class rounded-full to the "Adopt Oscar" button, which turns it into a pill.

Back

3/10

  1. 1. Borders
  2. 2. Border on One Side
  3. 3. Rounded Corners
  4. 4. Shadows
  5. 5. Images
  6. 6. Aspect Ratio
  7. 7. Rounded Corners on Pictures
  8. 8. Opacity
  9. 9. A Card from Scratch
  10. 10. Summary
Next

Try it yourself

Do this exercise right here in your browser. No account needed.