如何在svg的样式部分中为所有textPath元素应用startOffset?

startOffset的标记中放入textPath设置确实有效(startOffset=" 20%") 但是由于我有很多textPath,所以我想将此设置放入样式中。

该怎么做?有可能吗?

<svg width="1059" height="637"  viewBox="0 0 1059 637" xmlns="http://www.w3.org/2000/svg">
<style>  <![CDATA[  * { font-family: Corbel;font-size: 12px;font-weight: normal;font-style: normal;fill: #0000ff;text-anchor: start;white-space: pre;startOffset: 40%;method: align;text-decoration: none none;text-transform: none;font-variant: normal;text-shadow: none;word-spacing: 0px;letter-spacing: 0px;font-stretch: normal; }  
 textPath {  startOffset:" 20%" }     ]]> </style> 
<defs>
    <path id="a131" d="M46.5,172.5L57.5,172.5L63.5,172.5L65.5,172.5L72.5,172.5L73.5,172.5L77.5,172.5L82.5,172.5" />
</defs> 
<text>
    <textPath href="#a131">  Test Text                              Test Text</textPath>
</text> </svg>

是因为是属性而不是属性?

conandx 回答:如何在svg的样式部分中为所有textPath元素应用startOffset?

startOffset是一个属性,而不是CSS属性,因此无法通过CSS进行设置。 (method似乎是与我的程序相关的另一个属性。)

SVG presentation attributes that are CSS properties that can be used as attributes on SVG elements。围绕SVG元素的原始属性可以用于CSS样式的另一种方法不起作用。

本文链接:https://www.f2er.com/3096717.html

大家都在问