Base de conhecimentoCentro de Exames
PT · PTPortuguês (Portugal)
Escolher idioma13

CKTIS / CSS

corner-top-right-shape — forma do canto superior direito

A propriedade corner-top-right-shape define a forma do canto superior direito; o seu tamanho é determinado por border-top-right-radius.

Versão: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Sintaxe

corner-top-right-shape: round | scoop | bevel | notch | square | squircle | superellipse(<number> | calc(infinity) | calc(-infinity));

corner-top-right-shape aplica-se ao canto físico superior direito, independentemente da direção da escrita. Não é herdada e o seu valor inicial é round.

bevel cria um corte diagonal, enquanto scoop cria um arco côncavo. As outras opções são notch, square, squircle e superellipse(). A propriedade escolhe a forma, não o tamanho: se border-top-right-radius for zero, não há qualquer efeito visível.

Esta funcionalidade está descrita numa especificação em evolução. O exemplo requer verificação local; a inclusão na especificação, por si só, não comprova o suporte no Chromium 152.

Exemplos

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>corner-top-right-shape bevel</title>
  <style>
    .tile {
      width: 160px;
      height: 100px;
      background: #075985;
      border-top-right-radius: 32px;
      corner-top-right-shape: bevel;
    }
  </style>
</head>
<body>
  <div class="tile" role="img" aria-label="Blue tile used to test a top-right corner bevel"></div>
  <script>
    if (CSS.supports('corner-top-right-shape', 'bevel')) {
      console.log('corner-top-right-shape: supported');
      const style = getComputedStyle(document.querySelector('.tile'));
      const computed = style.getPropertyValue('corner-top-right-shape');
      const shape = computed === 'superellipse(0)' ? 'bevel' : computed;
      const [horizontal, vertical = horizontal] = style.borderTopRightRadius.split(/\s+/);
      console.log(`top-right: ${shape}, ${horizontal} × ${vertical} corner region`);
      console.log(`other radii (top-left, bottom-right, bottom-left): ${style.borderTopLeftRadius}, ${style.borderBottomRightRadius}, ${style.borderBottomLeftRadius}`);
    } else {
      console.log('corner-top-right-shape: unsupported');
    }
  </script>
</body>
</html>

Resultado

corner-top-right-shape: supported
top-right: bevel, 32px × 32px corner region
other radii (top-left, bottom-right, bottom-left): 0px, 0px, 0px

O código apresentado e o resultado declarado foram verificados num ambiente isolado pelo método registado na prova de verificação desta versão exata.

Fontes