Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.7k views
in Technique[技术] by (71.8m points)

How can I make this SVG polygon "wedge" always have 45 degree ends?

I'm trying to make this wedge shape has 45 degree angles at both ends.

enter image description here

As the size of its containing div changes, or the page is zoomed, that angle changes:

enter image description here

Here's my (abbreviated) code:

<div class="relative">
  <svg class="h-16p top-0 left-0 absolute w-full fill-current" viewBox="0 0 100 4" preserveAspectRatio="none">
    <polygon points="0,0 100,0 95,5 5,5" />
  </svg>
</div>

I'm using tailwindCSS - for those not familiar those classes translate to:

position: absolute;
width: 100%;
fill: currentColor;
height: 16px;
top: 0px;
left: 0px;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...