Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

javascript - How to get rid of border on a SVG image?

I am new to using SVG images, this is my first time using them. I am not a designer or an expert with CSS animations so I used a SVG wave generator. I am getting this weird border on the bottom of the SVG image, but it only does this on mobile viewports. I cannot figure out how to correctly resolve this issue.

Here is a screenshot of the lineWeird Mobile SVG border

Here is the SVG code in my HTML and the CSS I copied from the generator. Thanks for your help!

.custom-shape-divider-bottom-1611177487 {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        overflow: hidden;
        line-height: 0;
        border: none !important;
        stroke: transparent;
        stroke-width: 0px;
    }

    .custom-shape-divider-bottom-1611177487 svg {
        position: relative;
        display: block;
        width: calc(100% + 1.3px);
        height: 150px;
        border: none !important;
        stroke: transparent;
        stroke-width: 0px;
    }
 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="#2e38a4" fill-opacity="1" d="M0,160L48,165.3C96,171,192,181,288,197.3C384,213,480,235,576,250.7C672,267,768,277,864,261.3C960,245,1056,203,1152,197.3C1248,192,1344,224,1392,240L1440,256L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>
question from:https://stackoverflow.com/questions/65838982/how-to-get-rid-of-border-on-a-svg-image

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

1 Reply

0 votes
by (71.8m points)

I think problem is there in svg while you use this svg you used transform scalY for the adjust position what yoy need. its not a strok problem its because of the Viewport problem of the svg so just add the below margin-top : -1px; for fix that.

.custom-shape-divider-bottom-1611177487 {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        overflow: hidden;
        line-height: 0;
        border: none !important;
        stroke: transparent;
        stroke-width: 0px;
    }

    .custom-shape-divider-bottom-1611177487 svg {
        position: relative;
        display: block;
        width: calc(100% + 1.3px);
        height: 150px;
        border: none !important;
        stroke: transparent;
        stroke-width: 0px;
    }
   svg{
margin-top:-1px;
}
 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="#2e38a4" fill-opacity="1" d="M0,160L48,165.3C96,171,192,181,288,197.3C384,213,480,235,576,250.7C672,267,768,277,864,261.3C960,245,1056,203,1152,197.3C1248,192,1344,224,1392,240L1440,256L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...