Ken
Ken

Reputation: 892

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>

Upvotes: 4

Views: 4686

Answers (2)

Bhavik
Bhavik

Reputation: 228

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>

Upvotes: 3

Balaji
Balaji

Reputation: 11017

css class

.stroke{
    stroke: rgb(255,255,255);
    stroke-width: 0;
}

body{
background-color:red;
}
 .stroke{
stroke: rgb(255,255,255);
stroke-width: 0;
}

.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 class="stroke" 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>

Upvotes: 0

Related Questions