How to achieve a sharp corner on the bottom border with Styled Components in CSS

I am trying to create a green triangular section as shown in the highlighted screenshot. I am looking for ways to achieve this effect, particularly adding the "corner" to the bottom border of the container.

Here is my desired outcome: https://i.sstatic.net/8tiwa.png

The current approach I am taking involves working with a black container. My goal is to incorporate the green region mentioned earlier into the bottom-border of this container.

     <AudienceCategories>
        <HeadBar>
          <Logo src={'/static/logos/planto.png'} onClick={null} />
          <CreateAudience>
            <BsPlusCircleFill size={25} />
            <motion.div style={{ marginLeft: 10 }}>
              <SubText color="white">Create Audience</SubText>
            </motion.div>
          </CreateAudience>
        </HeadBar>
        <TextHolder>
          <Heading color="white">Audience Categories</Heading>
          <SubTextContainer>
            <motion.div style={{ width: '400px', display: 'inline-block' }}>
              <SubText color={nativeColors.white}>
                Browse different audience types to see micro-segments and user
                profiles!
              </SubText>
            </motion.div>
          </SubTextContainer>
        </TextHolder>
        <SubTextContainer>
          <motion.div
            style={{
              display: 'flex',
              marginTop: '50px',
              justifyContent: 'center'
            }}
          >
            <SearchInput
              placeholder="Search by user type"
              onChange={onSearchChange}
              value={searchString}
              customWidth={'650px'}
            />
          </motion.div>
        </SubTextContainer>
      </AudienceCategories>

Styled Components:

const Container = styled(motion.div)``;

const Logo = styled("img")`
    width: 114px;
    height: auto;
    object-fit: contain;
    margin: 20px 0;
    cursor: pointer;
`;

const Variants = styled(motion.div)`
    display: flex;
    flex-flow: row wrap;
    justify-content: space-evenly;
    margin: 0 auto;
    max-width: 1000px;
    width: 60%;
`;

const AudienceCategories = styled(motion.div)`
    min-height: 450px;
    background-color: ${nativeColors.pitchBlack};
    color: ${nativeColors.white};
`;

const HeadBar = styled(motion.div)`
    display: flex;
    justify-content: space-between;
    padding: 30px;
`;

const CreateAudience = styled(motion.div)`
    display: flex;
    cursor: pointer;
    justify-content: space-around;
    align-items: center;
`;

const TextHolder = styled(motion.div)`
    display: flex;
    margin-top: -30px;
    flex-direction: column;
    justify-content: center;
    text-align: center;
`;

const SubTextContainer = styled(motion.div)``;

Current attempt: https://i.sstatic.net/Qi1Ke.png

Any guidance on how to achieve this would be greatly appreciated. Thank you!

Answer №1

Utilize the Clip path feature in CSS to tackle your issue, here is a snippet of code that may help.

Check out this great website for creating unique clip path designs!

* {
  margin: 0%;
  padding: 0%;
}
.sec1 {
  height: 70vh;
  background-color: black;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 5vw), 70% 100%, 0 calc(100% -   10vw));
  margin-bottom: -15vw;
}
.sec2{
  height: 15vw;
  background-color: aqua;
  clip-path: polygon(0 0, 70% calc(100% - 5vw), 100% 30%, 100% calc(100% - 5vw),   70% 100%, 0 calc(100% - 10vw));
}
<div class="sec1"></div>
<div class="sec2"></div>

View the output on a desktop:

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

Answer №2

To remove all radius values, simply use the border-radius: 0; property. This will automatically eliminate any rounded corners caused by frames, hidden radii, or bugs.

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

Header Stability TransitionAndView

I'm not very experienced with JavaScript, so please bear with me. I'm attempting to create a fixed header that transitions to 50% opacity when scrolled down and returns to full opacity (opacity: 1.0) when scrolled back to the top. Here is my cur ...

Tips for customizing MUI button to maintain functioning color prop

I've been experimenting with customizing the MUI Button component and while my changes are consistent, I'm facing an issue where the color prop is no longer able to change the color of the Button. const theme = useTheme( components: { ...

Style sheets for two dynamically-sized boxes side by side

There are two boxes or columns positioned on the same line. Both have varying widths that need to remain on the same row. To clarify: .----------container 570px-----------. |[box1] [box2]| Ideal scenario | ...

Changing Highcharts Donut Chart Title Text via Legend Item Click in React

Utilizing React. In my Highcharts donut chart, there are 5 legend items of type 'number' and a 'title text' (also type: number) displayed at the center. The title text represents the sum of all the legend items. However, when I click o ...

Facing difficulties in resetting the time for a countdown in React

I've implemented the react-countdown library to create a timer, but I'm facing an issue with resetting the timer once it reaches zero. The timer should restart again and continue running. Take a look at my code: export default function App() { ...

A nested DragSource component within a parent DragSource component in React DnD

In my project, I am working with a tree structure that consists of a root "Tree" component containing a list of root "TreeNodes". Each TreeNode can have an arbitrary number of children. Within the render method of the TreeNode component, I iterate over th ...

Steps for deploying a Next.js frontend and a separate Express backend:1. First,

I am in the process of developing an application that utilizes next.js for the frontend and a standalone backend server built on express. As I plan for production deployment, I am concerned about costs and the most efficient approach to take. Although I ha ...

What is the best way to deactivate a hyperlink on a widget sourced from a different website?

Is there a way to remove the link from the widget I embedded on my website without access to other editing tools besides the HTML code provided? For instance, we have a Trustpilot widget at the bottom of our page that directs users to Trustpilot's web ...

What is the most efficient way to ensure only one item collapses open in Reactstrap?

I'm having trouble with my reactstrap collapse accordion for FAQs. I want only one item to be open at a time, but I can't seem to get it working. I've tried changing states of collapse, but all items still open. I even attempted to use uncon ...

Tips for placing a div within a curved div?

I've got a nested div situation, <div style="background-color: red; height: 100px; width: 100px; border-radius: 10px;" id="div1"> <div style="background-color: orange;" id="div2"> testing </div> </div ...

Content that can be scrolled within a React.Box container

I am struggling with a particular view. The columnBox I have can potentially hold a large number of items, but for some reason it's not scrolling in the view. I've already tried setting overflowY to auto, but since I don't know the exact hei ...

Automatically close the menu in ReactJS when transitioning to a new page

I have created a nested menu, but I am facing an issue with it. Here is the structure: Parent_Menu Parent1 > Child_Menu1 > Child_Menu2 Parent2 Currently, when I click on, for example, Child_Menu1, I am redirected to the correct page ...

Incorporating Close, Minimize, and Maximize functionalities into a React-powered Electron Application

Struggling with implementing minimize, maximize, and close functionality for a custom title bar in an electron app using React Typescript for the UI. The issue lies within the React component WindowControlButton.tsx, as it should trigger actions to manipu ...

Implementing jQuery UI toggleClass method to seamlessly alternate between two distinct CSS classes

My goal is to toggle between two CSS classes on a selector click using Jquery UI .toggleClass(), but unfortunately, it's not producing the desired toggle effect. $(".toggle").click(function () { $(".archivePosts .columns").removeClass( "l ...

Using CSS to cut out a triangle shape from an image

Our designer has a vision for this: However, I'm struggling to find a suitable method for creating the triangle crop effect: Implementing an :after element that spans the entire width and utilizes border tricks to form a triangle shape Creating a l ...

Is utilizing Eval on a div within a DataList ItemTemplate feasible for MouseOver event handling?

Apologies for the complicated title. Here is the structure of my DataList: <asp:DataList ID="DataListFloor" runat="server" RepeatColumns="5" > <ItemTemplate> <div style='width:199px;height:166px;background-color: <%# Ev ...

Pass side-effect functionalities between React components through injection or sharing

Currently, I am utilizing the Table component from the Ant Design Library and have successfully implemented custom filters for each column of the table. Now, I am looking to extend this approach to multiple tables as well. The issue arises with a set of fu ...

What is the best way to create a fixed positioning for a div within a Material-UI table container?

When using the Material UI Table, I encountered an issue with applying the sticky property. The table itself works fine, but I also have a button inside the TableContainer that should be sticky alongside the table head. I attempted to achieve this by using ...

What is the best way to layer a background image with a CSS gradient?

I've spent over an hour searching for the right answer with no luck, so I'm turning to you for help. On my main page, there's a div with a large image that looks like this: <div id="hero"></div> It's working perfectly at t ...

Using ReactJS to store form submissions for future API requests

I'm currently developing a React web application and facing an issue with saving input from a form submission to use in multiple API calls. While I am able to utilize the input initially for making an API call and displaying results, I am struggling ...