CSS border-top-right-radius Property

The border-top-right-radius property controls the rounding of an element's top-right corner.

It accepts one or two non-negative length or percentage values. A single length value creates a circular corner, while two values define the horizontal and vertical radii of an elliptical corner.

The property affects the physical top-right corner regardless of writing mode or text direction. It can round the element's background and border even when no visible border is defined.

border-top-right-radius Syntax

The property accepts one or two values that specify the corner's horizontal and vertical radii.

selector {
  border-top-right-radius: 20px;
}

The general syntax is:

selector {
  border-top-right-radius: <length-percentage> <length-percentage>?;
}

Single Length Value

.panel {
  border-top-right-radius: 20px;
}

Both radii are 20 pixels, producing a circular corner.

Two Length Values

.panel {
  border-top-right-radius: 40px 20px;
}

The horizontal radius is 40 pixels and the vertical radius is 20 pixels.

Percentage Value

.panel {
  border-top-right-radius: 25%;
}

Mixed Values

.panel {
  border-top-right-radius: 30% 20px;
}

Removing the Radius

.panel {
  border-top-right-radius: 0;
}

Calculated Radius

.panel {
  border-top-right-radius: clamp(10px, 4vw, 40px);
}

CSS-Wide Keywords

.inherited {
  border-top-right-radius: inherit;
}
.reset {
  border-top-right-radius: initial;
}
.unset {
  border-top-right-radius: unset;
}
.reverted {
  border-top-right-radius: revert;
}
.layer-reverted {
  border-top-right-radius: revert-layer;
}

CSS-wide keywords must be used alone rather than combined with radius values.

Property Values

The border-top-right-radius property accepts non-negative lengths, percentages, or combinations of the two.

Value Description
<length> Defines a radius using a non-negative length such as px, rem, or em.
<percentage> Defines a radius relative to the dimensions of the element's border box.
One value Sets both the horizontal and vertical radii using the same specified value.
Two values Sets the horizontal radius first and the vertical radius second.
0 Removes rounding from the top-right corner.
inherit Inherits the computed radii from the parent element.
initial Resets both radii to zero.
unset Resets both radii to zero because the property is not inherited.
revert Reverts the property according to cascade origin rules.
revert-layer Reverts the property according to cascade layer rules.

Property Characteristics

Characteristic Value
Initial value 0
Inherited No
Applies to Elements that support border radius properties
Computed value Two absolute lengths or percentages
Animation type By computed value type
Accepted values One or two non-negative lengths or percentages
Property type Longhand
Physical corner Top-right

Negative values are invalid. The property does not accept the slash syntax used by the border-radius shorthand.

How It Works

The browser uses the specified radii to replace the square top-right corner with a curved edge.

Step 1: Create an Element

<div class="panel">
  This panel has a rounded top-right corner.
</div>

Step 2: Add Basic Styling

.panel {
  padding: 24px;
  background-color: #e7f3fc;
  border: 3px solid #1769aa;
}

Step 3: Round the Corner

.panel {
  border-top-right-radius: 30px;
}

The top-right corner becomes rounded while the other corners remain square.

Step 4: Create an Elliptical Corner

.panel {
  border-top-right-radius: 60px 25px;
}

The corner becomes wider horizontally than vertically.

Step 5: Remove the Rounding

.panel {
  border-top-right-radius: 0;
}

The top-right corner returns to a square shape.

Only the top-right corner is directly affected. The other three corners retain their existing radius values.

Circular Corners

A single length value defines equal horizontal and vertical radii, producing a circular corner.

Small Radius

.panel {
  border-top-right-radius: 8px;
}

Medium Radius

.panel {
  border-top-right-radius: 24px;
}

Large Radius

.panel {
  border-top-right-radius: 60px;
}

Using rem Units

.panel {
  border-top-right-radius: 2rem;
}

Using a Calculation

.panel {
  border-top-right-radius: calc(12px + 1vw);
}

The final rendered radius may be reduced automatically if it would overlap with the radii of neighboring corners.

Use a single length value when you want a consistently circular curve at the top-right corner.

Elliptical Corners

Two values define an elliptical corner. The first specifies the horizontal radius, and the second specifies the vertical radius.

Wide Elliptical Corner

.panel {
  border-top-right-radius: 80px 20px;
}

The corner extends farther along the top edge than along the right edge.

Tall Elliptical Corner

.panel {
  border-top-right-radius: 20px 80px;
}

The corner extends farther down the right edge than along the top edge.

Equal Radii

.panel {
  border-top-right-radius: 30px 30px;
}

Equal length radii produce a circular curve.

Mixed Length Units

.panel {
  border-top-right-radius: 4rem 20px;
}

Length and Percentage

.panel {
  border-top-right-radius: 50px 25%;
}

Zero Vertical Radius

.panel {
  border-top-right-radius: 40px 0;
}

If either radius is zero, the corner is not rounded.

Elliptical radii are useful for creating distinctive card shapes, banners, and decorative containers.

Percentage Values

Percentage radii are calculated relative to the dimensions of the element's border box.

The horizontal radius uses the border box width, while the vertical radius uses the border box height.

Single Percentage

.panel {
  border-top-right-radius: 25%;
}

Both radii use 25%, but they are calculated against different dimensions.

Two Percentages

.panel {
  border-top-right-radius: 50% 20%;
}

Mixed Percentage and Length

.panel {
  border-top-right-radius: 30% 40px;
}

Half-Width and Half-Height Radii

.panel {
  border-top-right-radius: 50%;
}

The horizontal radius is half the border box width, and the vertical radius is half its height.

Percentage With Fixed Dimensions

.panel {
  width: 240px;
  height: 120px;
  border-top-right-radius: 25%;
}

With the default content-box sizing and no padding or border, the horizontal radius is 60 pixels and the vertical radius is 30 pixels before any overlap scaling.

Responsive Percentage Radius

.panel {
  width: 100%;
  min-height: 160px;
  border-top-right-radius: 20%;
}

The radius adapts as the element's dimensions change.

Percentages are useful for proportional corner shapes, especially when the element's width or height changes responsively.

Length Units

The property supports CSS length units, including absolute and relative lengths.

Pixels

.panel {
  border-top-right-radius: 24px;
}

rem Units

.panel {
  border-top-right-radius: 2rem;
}

The radius is based on the root element's font size.

em Units

.panel {
  border-top-right-radius: 2em;
}

The radius is based on the element's font size.

Viewport Units

.panel {
  border-top-right-radius: 5vw;
}

Calculated Length

.panel {
  border-top-right-radius: calc(16px + 1rem);
}

Clamped Length

.panel {
  border-top-right-radius: clamp(12px, 4vw, 60px);
}

Two Different Units

.panel {
  border-top-right-radius: 4rem 24px;
}

Choose units based on whether the radius should remain fixed, scale with typography, or respond to viewport dimensions.

border-radius Shorthand

The border-radius shorthand can set the radii of all four corners in one declaration.

One Value for All Corners

.panel {
  border-radius: 20px;
}

All four corners receive the same radius.

Four Different Corners

.panel {
  border-radius: 40px 20px 10px 5px;
}

The values apply clockwise: top-left, top-right, bottom-right, and bottom-left.

Only the Top-Right Corner

.panel {
  border-radius: 0 40px 0 0;
}

This is equivalent to setting the top-right radius to 40 pixels and the other corners to zero.

Shorthand Followed by Longhand

.panel {
  border-radius: 12px;
  border-top-right-radius: 50px;
}

The top-right corner becomes 50 pixels, while the other corners remain 12 pixels.

Longhand Followed by Shorthand

.panel {
  border-top-right-radius: 50px;
  border-radius: 12px;
}

The later shorthand resets all four corners to 12 pixels.

Elliptical Shorthand

.panel {
  border-radius: 40px 60px 10px 5px / 20px 25px 5px 2px;
}

The values before the slash define horizontal radii. The values after the slash define vertical radii.

Equivalent Longhand

.panel {
  border-top-right-radius: 60px 25px;
}

The individual corner property uses two space-separated values, not slash syntax.

Use border-radius for multiple corners and border-top-right-radius when you need to control only the physical top-right corner.

Physical vs. Logical Corners

The border-top-right-radius property always targets the physical top-right corner.

Logical corner radius properties use the block and inline directions to determine which physical corner is affected.

Physical Top-Right Corner

.panel {
  border-top-right-radius: 30px;
}

Logical Start-End Corner

.panel {
  border-start-end-radius: 30px;
}

The logical property rounds the corner where the block-start and inline-end edges meet.

Horizontal Left-to-Right Text

.panel {
  writing-mode: horizontal-tb;
  direction: ltr;
  border-start-end-radius: 30px;
}

The logical start-end corner corresponds to the physical top-right corner.

Horizontal Right-to-Left Text

.panel {
  writing-mode: horizontal-tb;
  direction: rtl;
  border-start-end-radius: 30px;
}

The logical start-end corner corresponds to the physical top-left corner.

Vertical Right-to-Left Writing Mode

.panel {
  writing-mode: vertical-rl;
  direction: ltr;
  border-start-end-radius: 30px;
}

The logical start-end corner corresponds to the physical bottom-right corner.

Vertical Left-to-Right Writing Mode

.panel {
  writing-mode: vertical-lr;
  direction: ltr;
  border-start-end-radius: 30px;
}

The logical start-end corner corresponds to the physical bottom-left corner.

Physical and Logical Conflict

.panel {
  writing-mode: horizontal-tb;
  direction: ltr;
  border-top-right-radius: 20px;
  border-start-end-radius: 50px;
}

Both declarations target the same physical corner in this writing mode and direction. The later declaration wins when cascade priority is otherwise equal.

Use physical corner properties for fixed visual placement and logical corner properties when the design should adapt to writing direction.

Backgrounds and Borders

The corner radius affects the shape of the element's background and border, even when the border itself is not visible.

Background Without a Border

.panel {
  padding: 24px;
  background-color: #e7f3fc;
  border-top-right-radius: 40px;
}

The background follows the rounded corner without requiring a visible border.

Solid Border

.panel {
  border: 4px solid #1769aa;
  border-top-right-radius: 40px;
}

Thick Border

.panel {
  border: 12px solid #1769aa;
  border-top-right-radius: 50px;
}

The border follows the curved outer edge, with the inner curve adjusted for the border thickness.

Different Border Colors

.panel {
  border: 5px solid #cccccc;
  border-top-color: #1769aa;
  border-right-color: #c04b37;
  border-top-right-radius: 40px;
}

The top and right border colors meet along the rounded corner.

Gradient Background

.panel {
  padding: 24px;
  border-top-right-radius: 50px;
  background: linear-gradient(225deg, #e7f3fc, #ffffff);
}

Background Clipping

.panel {
  border: 8px solid rgb(23 105 170 / 50%);
  border-top-right-radius: 40px;
  background-color: #e7f3fc;
  background-clip: padding-box;
}

The background is clipped to the padding box, while the border follows the rounded corner.

Border radius shapes the border and background painting areas but does not automatically clip all descendant content.

Content Clipping

Rounded corners affect an element's border and background, but descendant content may still extend beyond the rounded shape.

Rounded Container

.panel {
  border-top-right-radius: 40px;
  background-color: #e7f3fc;
}

The container's background is rounded, but a child element may still extend into the corner.

Clipping Descendant Content

.panel {
  border-top-right-radius: 40px;
  overflow: hidden;
}

The overflow setting clips descendant content to the container's padding edge, following the rounded corner where applicable.

Clipping an Image

<div class="image-card">
  <img src="example.jpg" alt="Example image">
</div>
.image-card {
  border-top-right-radius: 40px;
  overflow: hidden;
}
.image-card img {
  display: block;
  width: 100%;
  height: auto;
}

Rounding an Image Directly

.rounded-image {
  border-top-right-radius: 40px;
}

Clipping With clip-path

.panel {
  border-top-right-radius: 40px;
  clip-path: inset(0 round 0 40px 0 0);
}

The clip-path declaration creates an additional clipping shape. Its radii must be kept consistent with the intended border radius.

Use overflow clipping when necessary, but remember that it can also clip shadows, positioned content, and other visual effects extending outside the container.

Radius Overlap and Scaling

CSS automatically reduces corner radii when their combined sizes would overlap along an edge.

Large Top Corner Radii

.panel {
  width: 200px;
  height: 120px;
  border-top-left-radius: 150px;
  border-top-right-radius: 150px;
}

The combined horizontal radii exceed the element's width. The browser scales the radii proportionally so they fit.

Large Vertical Radii

.panel {
  width: 240px;
  height: 100px;
  border-top-right-radius: 40px 100px;
  border-bottom-right-radius: 40px 100px;
}

The combined vertical radii exceed the element's height, so the browser scales the radii.

Oversized Single Corner

.panel {
  width: 200px;
  height: 100px;
  border-top-right-radius: 300px;
}

The browser limits the rendered curve to fit the element's dimensions.

Percentage Radius

.panel {
  width: 200px;
  height: 100px;
  border-top-right-radius: 75%;
}

The horizontal and vertical radii are calculated from the border box dimensions, then scaled if necessary.

The browser uses a common scaling factor to preserve the proportions of the specified corner radii.

This behavior prevents neighboring corner curves from overlapping and keeps the final border shape valid.

Cascade and Overrides

The CSS cascade determines which top-right radius applies when multiple declarations target the same element.

Later Declaration

.panel {
  border-top-right-radius: 20px;
  border-top-right-radius: 50px;
}

The later declaration wins when cascade priority is otherwise equal.

Higher Specificity

.panel {
  border-top-right-radius: 20px;
}
.panel.featured {
  border-top-right-radius: 60px;
}

Shorthand Override

.panel {
  border-top-right-radius: 60px;
  border-radius: 12px;
}

The later shorthand resets the top-right corner to 12 pixels.

Longhand Override

.panel {
  border-radius: 12px;
  border-top-right-radius: 60px;
}

The top-right corner becomes 60 pixels, while the other corners remain 12 pixels.

CSS Layers

@layer base, components;
@layer base {
  .panel {
    border-top-right-radius: 12px;
  }
}
@layer components {
  .panel {
    border-top-right-radius: 40px;
  }
}

For normal declarations, the later layer takes precedence.

Resetting the Radius

.panel {
  border-top-right-radius: 40px;
}
.panel.square-corner {
  border-top-right-radius: 0;
}

The reset class removes the top-right corner rounding.

When troubleshooting corner radii, inspect both border-top-right-radius and the broader border-radius shorthand.

CSS Custom Properties

Custom properties can store reusable corner radii and make component variations easier to maintain.

Shared Radius

:root {
  --corner-radius: 30px;
}
.panel {
  border-top-right-radius: var(--corner-radius);
}

Fallback Radius

.panel {
  border-top-right-radius: var(--top-right-radius, 24px);
}

Component Variants

.card {
  --corner-radius: 20px;
  border-top-right-radius: var(--corner-radius);
}
.card.featured {
  --corner-radius: 60px;
}
.card.compact {
  --corner-radius: 8px;
}

Elliptical Radius Variables

.panel {
  --radius-x: 60px;
  --radius-y: 20px;
  border-top-right-radius: var(--radius-x) var(--radius-y);
}

Calculated Radius

:root {
  --base-radius: 12px;
}
.panel {
  border-top-right-radius: calc(var(--base-radius) * 3);
}

Responsive Radius Variable

.panel {
  --corner-radius: 40px;
  border-top-right-radius: var(--corner-radius);
}
@media (max-width: 600px) {
  .panel {
    --corner-radius: 16px;
  }
}

Custom properties help maintain consistent corner shapes across cards, panels, and other interface components.

Transitions and Animation

The border-top-right-radius property can animate between compatible radius values, creating smooth corner-shape transitions.

Hover Radius Transition

.panel {
  border-top-right-radius: 12px;
  transition: border-top-right-radius 0.3s ease;
}
.panel:hover {
  border-top-right-radius: 60px;
}

Elliptical Transition

.panel {
  border-top-right-radius: 20px 20px;
  transition: border-top-right-radius 0.4s ease;
}
.panel:hover {
  border-top-right-radius: 80px 30px;
}

Percentage Transition

.panel {
  border-top-right-radius: 10%;
  transition: border-top-right-radius 0.4s ease;
}
.panel:hover {
  border-top-right-radius: 40%;
}

Keyframe Animation

@keyframes corner-shape {
  0%, 100% {
    border-top-right-radius: 10px;
  }
  50% {
    border-top-right-radius: 80px 30px;
  }
}
.animated-panel {
  animation: corner-shape 3s ease-in-out infinite;
}

Selected State

.card {
  border-top-right-radius: 16px;
  transition: border-top-right-radius 0.3s ease;
}
.card.is-selected {
  border-top-right-radius: 60px;
}

Reduced Motion Preference

.panel {
  border-top-right-radius: 12px;
  transition: border-top-right-radius 0.3s ease;
}
.panel:hover {
  border-top-right-radius: 60px;
}
@media (prefers-reduced-motion: reduce) {
  .panel {
    transition: none;
  }
}

Corner radius transitions change the shape of the element without directly changing its box dimensions, although the visible painted area changes.

Responsive Design

Corner radii can adapt to viewport width, container dimensions, and component size.

Media Query

.panel {
  border-top-right-radius: 60px;
}
@media (max-width: 600px) {
  .panel {
    border-top-right-radius: 20px;
  }
}

Container Query

.panel-container {
  container-type: inline-size;
}
.panel {
  border-top-right-radius: 16px;
}
@container (min-width: 500px) {
  .panel {
    border-top-right-radius: 60px;
  }
}

Fluid Radius

.panel {
  border-top-right-radius: clamp(12px, 5vw, 80px);
}

Percentage Radius

.panel {
  border-top-right-radius: 25%;
}

The radius adapts to the element's border box dimensions.

Responsive Elliptical Radius

.panel {
  border-top-right-radius: 80px 30px;
}
@media (max-width: 600px) {
  .panel {
    border-top-right-radius: 30px 15px;
  }
}

Logical Corner Alternative

.panel {
  border-start-end-radius: 30px;
}

For horizontal left-to-right text, the logical start-end corner is the physical top-right corner. In other writing modes or directions, it may map to a different corner.

Responsive radii can preserve a consistent visual style while adapting the curve to different component dimensions.

Practical Uses

The border-top-right-radius property is useful for asymmetrical cards, decorative panels, images, and interface accents.

Asymmetrical Card

.card {
  padding: 24px;
  background-color: #e7f3fc;
  border-top-right-radius: 60px;
}

Featured Panel

.featured-panel {
  padding: 24px;
  border: 3px solid #1769aa;
  border-top-right-radius: 80px 30px;
}

Rounded Image

.featured-image {
  display: block;
  max-width: 100%;
  border-top-right-radius: 50px;
}

Decorative Banner

.banner {
  padding: 30px;
  background-color: #1769aa;
  color: #ffffff;
  border-top-right-radius: 100px 40px;
}

Notification Panel

.notification {
  padding: 20px;
  background-color: #fff8e8;
  border-right: 5px solid #b7791f;
  border-top-right-radius: 30px;
}

Rounded Table Container

.table-container {
  border: 1px solid #cccccc;
  border-top-right-radius: 20px;
  overflow: hidden;
}

Custom Shape

.shape {
  width: 200px;
  height: 120px;
  background-color: #1769aa;
  border-top-right-radius: 100% 100%;
}

Hover Shape Change

.card {
  border-top-right-radius: 16px;
  transition: border-top-right-radius 0.3s ease;
}
.card:hover {
  border-top-right-radius: 60px;
}

Individual corner radii allow you to create distinctive shapes without adding extra markup or image assets.

border-top-right-radius Example

The following example compares circular, elliptical, percentage-based, and square top-right corners.

<div class="border-top-right-radius-demo">
  <div class="demo-box small">12px</div>
  <div class="demo-box medium">30px</div>
  <div class="demo-box large">60px</div>
  <div class="demo-box wide">80px 20px</div>
  <div class="demo-box tall">20px 70px</div>
  <div class="demo-box percent">25%</div>
  <div class="demo-box mixed">40% 20px</div>
  <div class="demo-box square">0</div>
</div>
.border-top-right-radius-demo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 20px;
}
.border-top-right-radius-demo .demo-box {
  box-sizing: border-box;
  min-height: 120px;
  padding: 20px;
  border: 3px solid #1769aa;
  background-color: #e7f3fc;
  color: #173b5e;
  font-weight: bold;
  text-align: center;
}
.border-top-right-radius-demo .small {
  border-top-right-radius: 12px;
}
.border-top-right-radius-demo .medium {
  border-top-right-radius: 30px;
}
.border-top-right-radius-demo .large {
  border-top-right-radius: 60px;
}
.border-top-right-radius-demo .wide {
  border-top-right-radius: 80px 20px;
}
.border-top-right-radius-demo .tall {
  border-top-right-radius: 20px 70px;
}
.border-top-right-radius-demo .percent {
  border-top-right-radius: 25%;
}
.border-top-right-radius-demo .mixed {
  border-top-right-radius: 40% 20px;
}
.border-top-right-radius-demo .square {
  border-top-right-radius: 0;
}
Browser Result
12px
30px
60px
80px 20px
20px 70px
25%
40% 20px
0

The first three examples use circular radii of increasing size. The wide and tall examples demonstrate elliptical curves.

The percentage examples scale with the element's dimensions, while the final example retains a square top-right corner.

Important Considerations

Keep the following points in mind when using border-top-right-radius:

  • Purpose: Rounds the physical top-right corner of an element.
  • Initial value: 0.
  • Inheritance: The property is not inherited.
  • Accepted values: One or two non-negative lengths or percentages.
  • Single value: Defines equal specified horizontal and vertical radii.
  • Two values: Defines the horizontal radius first and the vertical radius second.
  • Percentage values: Use border box width for horizontal radii and border box height for vertical radii.
  • Negative values: Invalid.
  • Zero radius: Produces a square corner.
  • Physical corner: Always affects the top-right corner regardless of writing mode.
  • Logical alternative: Use the appropriate logical corner radius property for writing-mode-aware layouts.
  • Border requirement: A visible border is not required for the background to appear rounded.
  • Content clipping: Descendant content is not automatically clipped to the rounded corner.
  • Radius overlap: Browsers scale radii proportionally when necessary to prevent overlap.
  • Shorthand interactions: A later border-radius shorthand can override the individual corner radius.
  • Slash syntax: Not supported by the individual corner property.
  • Custom properties: Can store reusable radius values.
  • Animation: Compatible radius values can interpolate smoothly.
  • Browser support: The property is widely supported.

Use border-top-right-radius when you need to round one specific physical corner without changing the other three corners.

Browser Support

The border-top-right-radius property is widely available and supported in Chrome, Edge, Firefox, Safari, and other major browsers.

Modern browsers support circular and elliptical radii, percentage values, and transitions without requiring vendor prefixes.

.panel {
  border-top-right-radius: 40px 20px;
}

This declaration rounds only the physical top-right corner.

For current compatibility details, visit Can I Use? and search for border-top-right-radius.

Specifications

The border-top-right-radius property is defined in the CSS Backgrounds and Borders Module Level 3 specification.

CSS Backgrounds and Borders Module Level 3

The specification defines circular and elliptical corner radii, percentage calculations, and the rules for scaling overlapping corner curves.