KennisbankExamencentrum
NL · NLNederlands (Nederland)
Taal kiezen13

CKTIS / CSS

CSS-eigenschap `outline-width`

`outline-width` stelt de lijndikte van de contour van een zichtbare contour buiten de rand in.

Versie: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review

Syntax

<line-width>

outline-width stelt de lijndikte van de contour van een zichtbare contour buiten de rand in.

Het voorbeeld maakt een contrasterende solid-contour met positieve dikte, past de component toe en meldt de volledige berekende contour.

Grammatica: <line-width>.

Een contour verandert geen lay-outafmetingen en kan buren overlappen; bij outline-style:none levert een dikte geen zichtbare verf op.

Voorbeelden

<!doctype html><html lang="en"><meta charset="utf-8"><title>CKTIS CSS example</title><body><pre id="result"></pre><script>const x=document.createElement("button");document.body.prepend(x);x.textContent="focus";x.style.cssText="width:80px;height:40px;outline:4px solid rgb(0 0 0)";const before=x.getBoundingClientRect();x.style.setProperty("outline-width","6px");const after=x.getBoundingClientRect(),s=getComputedStyle(x);document.querySelector("#result").textContent="outline="+s.outlineWidth+" "+s.outlineStyle+" "+s.outlineColor+"; offset="+s.outlineOffset+"; layout="+Math.round(before.width)+"x"+Math.round(before.height)+"->"+Math.round(after.width)+"x"+Math.round(after.height);</script></body></html>

Resultaat

outline=6px solid rgb(0, 0, 0); offset=0px; layout=80x40->80x40

Het voorbeeld is lokaal uitgevoerd in een geïsoleerde Chrome-sessie zonder netwerk; het resultaat komt uit de CSS-API van de browser.

Bronnen