1

I made an SVG image, but when I add it to a page and set the width value to 100%, it still doesn't extend over the entire width of the page, there is still small gaps that remain at the edges.

I tried to change value to 100vw but then the image is widther. When I fullscreen the page then everything is okay.

IMG

HTML:

<footer>
    <div class="footer-top-shape">
        <img class="footer-top-shape-img" src="./svgs/footershape26.svg" alt="Footer shape">
    </div>
    <div class="footer-container">
        <div class="footer-content">

CSS:

footer{
    height: auto;
    width: 100%;
    background-color: #0a2233;
}

.footer-top-shape-img{
    width: 100%;
    height: auto;
}

.footer-container{
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
}
M0nst3R
  • 5,186
  • 1
  • 23
  • 36
keir
  • 17
  • 3

1 Answers1

1

I suppose you are using Chrome. The problem could be then in the way (bug if you want) the Chrome processes .svg because FF seems to show it correctly without any margins.

I've found this answer: background-size:100% 100%; doesn't work properly in Chrome

Edit your .svg and add the property preserveAspectRatio="none" into the <svg> element.

Tomas Kuba
  • 26
  • 3