html - specifying values for d attribute of path tag in percentage -


how can use percentage values d attribute of path tag?

for example:

<path stroke-width="4" d="m1% 10% l100% 0" /> 

does not work.

since want reuse elements in svg tag on change in svg size, i'm looking absolute values (in percentage).

thanks on advance..

svg path data allow dimensionless numbers, period.

if want change size of path, doing transform attributes or establishing new viewport. example, wrap path <svg> element inside outermost <svg>:

<svg ...>     <svg viewbox="0 0 100 100" x="0" y="10%" width="100%" height="100%">         <path stroke-width="4" d="m1 10 l100 0" />     </svg> </svg> 

there, define path coordinates absolute values. inner <svg> defines viewbox such path spans amount want. relative sizing , positioning possible x, y, width , height attribute.

if want reuse same element multiple times, can same <symbol> (a template won't rendered itself) , <use> elements referencing it:

<svg ...>     <symbol id="mypath" viewbox="0 0 100 100">         <path stroke-width="4" d="m1 10 l100 0" />     </symbol>     <!-- relative sizes -->     <use xlink:href="#mypath" width="100%" height="100%" />     <!-- absolute sizes -->     <use xlink:href="#mypath" width="200" height="160" />     <!-- using transforms -->     <use xlink:href="#mypath" transform="translate(50, 0) scale(3.5)" /> </svg> 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -