La stroke-width
proprietà in CSS serve per impostare la larghezza di un bordo su forme SVG.
.module ( stroke-width: 2; )
Ricorda:
- Questo sarà sovrascrivere un attributo di presentazione
- Questo non sovrascriverà uno stile in linea ad es
Valori
La stroke-width
proprietà può accettare qualsiasi numero, inclusi numeri interi, decimali e percentuali:
stroke-width: 2px
stroke-width: 2em
stroke-width: 2
stroke-width: 2.5
stroke-width: 15%
Notare che un identificatore di unità (cioè px
e em
) non è richiesto. Un numero senza unità è un valore basato sul sistema di coordinate dell'SVG viewBox
. Quindi, ad esempio, il 5
rendering è uguale 5%
a viewBox
quello impostato su 0 0 100 100
(5/100 = .05 o 5%) ma 10%
in uno che è 0 0 50 50
(5/50 = .1 o 10%).
Vedi la proprietà Pen stroke-width di CSS-Tricks (@ css-tricks) su CodePen.
Relazionato
stroke
stroke-dasharray
stroke-dashoffset
stroke-linecap
Maggiori informazioni
- Specifiche SVG 1.1
- MDN su riempimenti e tratti
Supporto browser
Cromo | Safari | Firefox | musica lirica | IE | Android | iOS |
---|---|---|---|---|---|---|
sì | sì | sì | sì | 9+ | 4.4+ | sì |