Znalostná bázaCentrum skúšok
SKSlovenčina
Vybrať jazyk13

CKTIS / CSS

corner-top-right-shape — tvar pravého horného rohu

Vlastnosť corner-top-right-shape určuje tvar pravého horného rohu; jeho veľkosť určuje border-top-right-radius.

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

Syntax

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

corner-top-right-shape sa vzťahuje na fyzický pravý horný roh bez ohľadu na smer písania. Nededí sa a jej počiatočná hodnota je round.

bevel vytvorí diagonálne skosenie, zatiaľ čo scoop vytvorí konkávny oblúk. Ďalšie možnosti sú notch, square, squircle a superellipse(). Vlastnosť vyberá tvar, nie veľkosť: pri nulovej hodnote border-top-right-radius nie je viditeľný žiadny efekt.

Táto funkcia je opísaná v špecifikácii, ktorá sa naďalej vyvíja. Príklad treba lokálne overiť; samotné uvedenie v špecifikácii nepotvrdzuje podporu v Chromium 152.

Príklady

<!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>

Výsledok

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

Zobrazený kód a uvedený výsledok boli overené v izolovanom prostredí metódou zaznamenanou v dôkaze o overení tejto presnej verzie.

Zdroje