triangular shape at the top and rounded shape at the bottom combined with various colors

Is there a way to create a triangle with a rounded bottom section in a different color?

 #box {
    content:"";
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 150px 150px 150px;
    border-color: transparent yellow red blue;
    position: relative;
 }

Result:

https://i.sstatic.net/9FP9N.jpg

My goal is to have a green rounded bottom section on the triangle shape:

https://i.sstatic.net/Mw6cx.jpg

Answer №1

Here is a solution that may be useful for you

#box {
    content:"";
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 150px 150px 150px;
    border-color: transparent yellow red blue;
    position: relative;
 }
 #box:before{
    content: '';
    width: 300px;
    height:  300px;
    display: block;
    background-color:green;
    border-radius: 50%;
    position: absolute;
    left: -150px;
    z-index: -1;
 }

Snippet:

#box {
    content:"";
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 150px 150px 150px;
    border-color: transparent yellow red blue;
    position: relative;
 }
 #box:before{
   content: '';
   width: 300px;
   height:  300px;
   display: block;
   background-color:green;
   border-radius: 50%;
   position: absolute;
   left: -150px;
   z-index: -1;
 }
<div id="box"></div>

Feel free to explore the fiddle

Answer №2

.bottom {
  height: 150px;
  width: 300px;
  background:green;
  border-bottom-left-radius: 300px;
  border-bottom-right-radius: 300px;
}

 #box {
    content:"";
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 150px 150px 150px;
    border-color: transparent yellow red blue;
 }
<div id="box"></div>

<div class="bottom"></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

Tips for securely storing visitor-entered form data on our computer from our webpage

Is there a way to store the information filled out by visitors on our website? <ul class="form"> <li class="short"> <label>First Name<span class="required"></span></ ...

SASS: incorporating loops within CSS properties

Is there a way to generate multiple values for a single property in CSS? background-image: radial-gradient(circle, $primary 10%, transparent 10%), radial-gradient(circle, $primary 10%, transparent 10%), radial-gradient(circle, $primary 10%, tr ...

Implement responsive data tables by setting a specific class for hiding columns

Having trouble assigning a specific class name to individual columns in datatables? It seems that when columns are hidden using the responsive extension, the desired class is not applied. Looking for a solution or workaround. Check out this example from D ...

What could be causing the PAGE CSS to malfunction?

I am looking to export HTML text as a word document with A4 size and portrait orientation. My JavaScript currently allows me to export the text, but it appears like a webpage format rather than in A4 or portrait mode. I have tried adding @page CSS styling ...

Adjust the table height to 25% and include a vertical scrollbar using Bootstrap styling

I have been working on designing a web page layout that includes two status tables positioned side by side at the top. While I have successfully set this up, I am facing an issue with implementing a vertical scroll feature specifically for the right-hand t ...

Choose a HTML element <a> containing a hyperlink reference and a nested child element <li>

Does anyone know of a way in javascript/css to select the (n) <li> in my code, while also specifying that the <li> must have a parent with the current <a> tag containing a specific href link? <a href="www.link.com">CATEGORY NAME& ...

Modify the color scheme of an HTML webpage

Looking to enhance my HTML page with a new feature. The page is responsive and currently using Bootstrap CSS and JS. My goal is to allow users to change the color of the page dynamically by selecting a background or text color. Check out this example link ...

Combine the jQuery selectors :has() and :contains() for effective element targeting!

I am trying to select a list item element that has a label element inside it. My goal is to use the :has() selector to target the list item and then match text within the label using the :contains() selector. Can I achieve this in a single line of jQuery ...

Combining rows and columns in Flexbox design

https://i.stack.imgur.com/tDLii.png I'm able to easily create this layout using the float property, but I'm having some difficulties achieving the same with flexbox. CSS: .a { background: red; float: left; width: 30%; ...

Unable to access account: HTML Javascript login issue

Problem with Login Code As a newcomer to HTML, CSS, and almost unknown in Javascript, I sought help from others to create a login code. The code was working fine earlier, but now it's not functioning as expected. Despite checking everything, I can&ap ...

utilizing a dynamic value within CSS modules for class naming

Struggling to incorporate a variable into a CSS module class name in Next.js. Finding it challenging to determine the correct syntax. The variable is fetched from the API: const type = red Here's how I'm attempting to achieve it: <div clas ...

CSS problem with padding and width

Currently, I'm working on a conditional rendering issue where I want to give a div full width but due to padding applied to its parent, it's not expanding to the container's full width. Here is the snippet of the code: import Image from &qu ...

Tips for positioning text on the left and right sides of a div in HTML styling

I am struggling with positioning two pieces of text within a div. Despite having some styling already in place, the text is currently displaying one after the other on the left-hand side. I want to position one piece of text to the left and another to the ...

Exploring the internet using a specific font style and ensuring a

I am facing an issue with the fonts on my website. They work perfectly in all browsers when using http, but as soon as I switch to https, the fonts stop working in IE8 and lower versions. However, they do display correctly in ie9. When trying to access th ...

In order to ensure proper coverage for phones, tablets, and standard screens across various widths, it is essential to implement the

As I delve into my project focused on responsive design and media queries, I have been studying resources like Aaron Gustavson's book, Adaptive Web Design, and Ben Frain's Responsive Web Design with HTML5 and CSS3, along with various online sourc ...

increasing the top margin on an HTML document

Looking to create a specific amount of blank space at the top of your HTML page? The space needs to be exactly X pixels tall. How can this be achieved effectively, while ensuring compatibility with Safari? ...

Static size element overlapping side panel

I am trying to center a fixed width element on my page, ensuring that it stays centered if it fits within the page width but extends beyond the page if needed with scroll accessibility. I have almost achieved this, but the element overlaps with the sidebar ...

Enable compatibility with high resolution screens and enable zoom functionality

My goal is to ensure my website appears consistent on all screen sizes by default, while still allowing users to zoom in and out freely. However, I've encountered challenges with using percentages or vh/vw units, as they don't scale elements prop ...

Steps to access a Windows folder after clicking on a link within an HTML page using Asp.net

I attempted to use the following code : <a href="file:///C:\Programs\sort.mw">Link 1</a> <a href="file:///C:\Videos\lecture.mp4">Link 2</a> Unfortunately, this code does not work in Google Chrome or Firefox bro ...

Retrieve the current font style with Kendo UI Editor

Recently, I've been facing some challenges while working with the Kendo UI Editor. Specifically, I'm struggling to retrieve the current font style. My goal is to use JavaScript or jQuery to obtain the following values: Values I am looking for: ...