What is the best way to remove the unwanted border that is showing up at the bottom of the SVG image?

Working with a wave SVG is presenting me with a challenge. I am noticing a border at the bottom that I would like to eliminate.

Below is my JSX code:

<DarkWave>
  <svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120" preserveAspectRatio="none">
     <path d="M321.39,56.44c58-10.79,114.16-30.13,172-41.86,82.39-16.72,168.19-17.73,250.45-.39C823.78,31,906.67,72,985.66,92.83c70.05,18.48,146.53,26.09,214.34,3V0H0V27.35A600.21,600.21,0,0,0,321.39,56.44Z"
           class="shape-fill"></path>
     </svg>
</DarkWave>

This is the CSS portion of the code:

export const DarkWave = styled.div`
    width: 100%;
    overflow: hidden;
    line-height: 0;
    height: 95vh;
    background-color: #705df2;
    transform: rotate(180deg);
    margin-bottom: 5rem;

    svg {
        position: relative;
        display: block;
        width: calc(100% + 1.3px);
        height: 127px;
        
    }

    path.shape-fill {
        fill: #ffffff;
    }
`;

I attempted to make the stroke transparent, but it did not resolve the issue:

svg{
 .........
 stroke: transparent;
 stroke-width: 0px;
}

Here is a glimpse of the problem in an image:

https://i.sstatic.net/zOtKb.png

Your advice on this matter would be greatly appreciated.

Answer №1

When the SVG is stretched, you may notice a slight "anti-aliasing" effect on the edges.

In this particular case, I have reversed the transparent and colored sections to create a mask that dictates which part remains visible. While I encountered a similar issue before, it has become easier to overlap elements within the mask.

div {
  width: 100%;
  overflow: hidden;
  margin-bottom: 5rem;
}

svg {
  display: block;
  height: 95vh;
  width: 100%;
}

svg>rect {
  fill: #705df2;
}
<div>
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 712" preserveAspectRatio="none">
    <defs>
      <mask id="m1">
        <rect width="1200" height="1200" fill="black" />
        <rect width="1200" height="601" fill="white" />
        <!-- height above 601 = overlapping area -->
        <path transform="translate(0 600)" d="M321.39,56.44c58-10.79,114.16-30.13,172-41.86,82.39-16.72,168.19-17.73,250.45-.39C823.78,31,906.67,72,985.66,92.83c70.05,18.48,146.53,26.09,214.34,3V0H0V27.35A600.21,600.21,0,0,0,321.39,56.44Z" fill="white" />
      </mask>
    </defs>
    <rect width="1200" height="1200" mask="url(#m1)" fill="white" />
  </svg>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

I am currently exploring options on how to eliminate the excess space at the top of the screen when viewing on smaller devices like mobile phones and tablets

Utilizing bootstrap for my layout, I have a row with 4 columns where the content within each div has varied top margins. This creates a cascading effect and looks great on desktop screens. However, the issue arises when viewing it on smaller screens as the ...

Show or hide side menu depending on when a div reaches the top of the

I have a side menu that opens when a specific div reaches the top of the window. The menu includes a toggle button for opening and closing it. However, I am encountering an issue where the script keeps closing the menu on scroll even after manually openi ...

Display exclusively the provided value

Can someone please help me with printing in PDF style and displaying only the inputted value without showing the textbox or dropdown? Check out this image for reference I would like to achieve something similar, how can I do that? Any assistance would be ...

Tips for accessing jQuery UI tab elements and adjusting visibility for specific panels

How can I retrieve the panel numbers of jQuery UI tabs and adjust their visibility using CSS? I am looking to identify the panel numbers of each tab and control the visibility of certain tabs. <div id="tabs"> <ul> <li><a href="#"> ...

CSS3 family tree tutorial: Incorporating a wife into the design

I came across a fascinating tutorial about creating a family tree using CSS3 only. However, I'm struggling to understand how to depict a marriage. To explain further: What the code currently accomplishes is this: what i aim to include is this: Alth ...

iOS iframe remains unscrollable only when switching from portrait to landscape orientation

I have a scrollable iframe set up on iOS like this: <div style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; overflow: scroll; -webkit-overflow-scroll: touch; ..."> <iframe style="height: 600px, ..."> </iframe> </d ...

What could be causing the background of the wrapper image not to display?

I am looking to add a background image specifically within the wrapper div on my website. Below is the HTML document: <!DOCTYPE html> <html lang="en"> <head> <meta charset="<?php bloginfo('charset'); ?>"> &l ...

Challenges with Implementing Background Images on my Website with HTML and CSS

Being new to the world of coding, I recently created a website for a college presentation. However, after uploading the website onto the internet, I noticed that the background images from my files are not displaying on the website. It's likely that I ...

I am looking for a pair of HTML tags that will allow one to be visible while the other is hidden, and then switch when needed

I am in the process of constructing a webpage dedicated to learning Japanese vocabulary. Each word will be presented within a sentence, just like the example shown below. 森林に散歩する take a walk in the forest In order to facilitate the practic ...

How can I position the hyperlink inline with the font-awesome Icon?

Hey everyone, I'm having some trouble creating a top info bar in Bootstrap 4.1.3 with Font-awesome 5.5. I want to include essential details like phone number, email address, and social icons, but whenever I try to add a hyperlink after the icon, it dr ...

Is there a way to replicate this exact toggle selection functionality from Angular Material using just HTML and CSS?

I'm attempting to incorporate this functionality into my Angular project ( link ), but I'm facing challenges with styling it using CSS. Could this be due to limitations in overriding the default settings? I came across this helpful resource: sour ...

Modify the colors of the chartist fill and stroke using JavaScript

Struggling to dynamically set colors in a chartist graph using JavaScript. How can custom colors be applied through JS? The attempted method below is not successfully changing the color for the showArea in the chartist graph. <!doctype html> <htm ...

Is there a way to implement a JavaScript function that can dynamically update the color scheme and background colors of all HTML pages within my website?

Looking for help on implementing a Javascript function that can modify the color schemes and background on all pages of my website. I tried using a function but it's only affecting one page. Can anyone offer guidance or suggestions? I'm finding t ...

Is it possible for the bootstrap grid system to utilize the width of the parent element "container-fluid" as its media query?

Within Bootstrap 5.2, the grid system's breakpoints are determined by the width of the screen through @media. While this approach works well for most cases, it becomes challenging when dealing with nested grids. In my current project, I am utilizing ...

CSS - Incorporate the value of the counter() function as a property value

Is it possible to increment the margin-top of an element based on its index using a counter()? For example: div { margin-top: calc(counter(myCounter) * 10px); } I couldn't find any information on whether this is achievable or not. Since counters ...

Troubleshooting Problem with Responsive Bootstrap Navbar

I've been working on creating a menubar using Bootstrap where the logo image is centered instead of being on the left side of the bar. However, I'm facing an issue where the right links in the menu go off the screen. When I view the page with a w ...

Tips on displaying inline span text within an anchor element, above the anchor text

Check out the code I've created below: .tooltip1 { z-index: 1; position: relative; } .tooltip1 .tooltiptext { visibility: hidden; width: 300px; ...

The battle between percentages and pixels in fluid design

I am looking to create a flexible layout and would like to achieve the following: width:100%-200px; This means having a div that contains content, referred to as div id="content", with a fixed margin on each side. I have attempted to place the div id="co ...

Is there a way to prevent tags from wrapping and showcase them all in a single line when utilizing the jQuery select2 plugin?

I have a requirement to prevent tags from wrapping and instead display them in a single line using the jQuery TagIt plugin. Check out my preview: https://i.stack.imgur.com/lYhsi.png My goal is to have all the tags displayed on a single line without wra ...

Menu: animated opening/closingIs this convenient, or

How can I add animation to opening and closing menu items in my project? I am not sure if it can be done in Angular or CSS. I have provided a reproduction of the project for reference => Stackblitz. HTML file <div class="wrapper"> & ...