0
我有最糟糕的問題要弄清楚:我試圖改變一個SVG線的顏色,因爲它跨過用css創建的三角背景。SVG重疊css三角形和顏色變化
我試圖使用漸變,看起來不錯,但它不完全是我想要的效果。
我希望它能讓svg描邊顏色隨着跨越到紅色三角形中而考慮到對角線效應而變爲白色。我得出的結論是,這是不可能的。我已經嘗試過圖層和SVG,但似乎找不到辦法。
我的代碼:
.triangle2 {
background: rgba(0, 0, 0, 0) linear-gradient(to left bottom, transparent 50%, #ed1d25 50%) repeat scroll 0 0;
bottom: 0;
height: 295px;
position: absolute;
width: 100%;
z-index: 7;
}
.layer-id-6 {
height: 100%;
position: absolute;
top: 0;
width: 100%;
z-index: 99;
}
<div class="triangle2"> </div>
<div class="layer-id-6">
<svg id="Layer_6" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" x="100%" y="100%" style="height: 100%">
<g class="all">
<line id="line25" x1="62.4%" y1="0" x2="62.4%" y2="100%" stroke="#000" style="fill:none; stroke-width: 20" />
</g>
</svg>
</div>
有沒有人對我怎樣才能做到這一點任何想法?
請參閱我的小提琴 https://jsfiddle.net/xxfairydragonxx/1o40th7v/
背景三角形是HTML還是SVG的實際要求?如果兩者都是SVG,則可以使用SVG過濾器來實現。另外,對於這個問題的絆腳石,你可能應該包括兩張照片,一張是你目前得到的,另一張是你想得到的。 – jcaron