Curved base of the main banner image

Struggling to achieve the perfect curve at the bottom of my hero image. Any suggestions on how to accomplish this would be greatly appreciated.

I am aiming for something like this: https://i.stack.imgur.com/Emxfc.png

body {
  margin: 0;
  background: lightblue;
}

div#hero {
  display: flex;
  flex: 1;
  position: relative;
  height: 50vh;
  background-image: url('https://wallpaperbrowse.com/media/images/soap-bubble-1958650_960_720.jpg');
  width: 100%;
  border-bottom-left-radius: 130% 600px;
  border-bottom-right-radius: 130% 600px;
  margin-left: -2em;
  padding-right: 4em;
}

.button {
  height: 60px;
  width: 180px;
  padding: 10px;
  border-radius: 5px;
  background-color: blue;
  margin: -25px auto;
  align-self: flex-end;
}

Answer №1

Adjusting the dimensions by decreasing the vertical scale and increasing the horizontal scale seems to bring you closer, like this:

border-bottom-left-radius: 150% 200px;
border-bottom-right-radius: 150% 200px;

Another option could be utilizing clip-path to create a customized shape. Update your CSS to include:

#hero {
  display: flex;
  flex: 1;
  position: relative;
  height: 50vh;
  background-image: url('https://wallpaperbrowse.com/media/images/soap-bubble-1958650_960_720.jpg');
  width: 100%;
  clip-path: polygon(0% 0%, 0% 85%, 50% 100%, 100% 85%, 100% 0%);
  margin-left: -2em;
  padding-right: 4em;
}

The drawback is that IE/Edge do not support it, but most other browsers do (Chrome/Firefox/Opera/Mobile).

I believe this is an excellent reference on the topic and offers some valuable examples.

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

Stop cascading styles when using nested rules in LESS to prevent unintended style application

In the process of developing a sophisticated front-end system using plugins, we are exploring different methods for composing CSS rules. Currently, we are considering two main approaches: Including parents in the class name Nesting parents in the selecto ...

"Preventing the propagation of a click event on an anchor tag with

Is there a way to prevent the parent anchor from executing its href when a child element is clicked, despite using stopPropagation? Here is the markup provided: <div id="parent"> <h5>Parent</h5> <a id="childAnchor" href="https:// ...

I am struggling to capture the user's input and display it on a webpage using HTML and JavaScript. Can you help me identify where I may be going wrong in this process?

Good day! I am fairly new to the programming world and have recently embarked on my first JavaScript project. I've chosen to create a simple budgeting app. However, I'm struggling with displaying user input on the page. Something seems off with ...

Yii2 Gridview - Horizontal Scroll Bar at the Top of the Page

I found a helpful post on Stack Overflow about creating a Yii2 Gridview with a fixed first column (Yii2 : Gridview with fixed first column), and now I'm looking to add a horizontal scrollbar at the top of the grid. My users really appreciate being ab ...

Utilizing combined selectors in styled-components: A comprehensive guide

My existing CSS code is structured like this: .btn_1 { color: #fff; background: #004dda; display: inline-block; } .btn_1:hover { background-color: #FFC107; color: #222 !important; } .btn_1.full-width { display: block; width: 100%; } I ...

Should the letter 'p' be inserted into the letter 'a'?

After viewing a video on Bootstrap, I noticed an unusual occurrence where there was a p element nested inside an a element. Is this considered acceptable in terms of HTML semantics? ...

Create an animation effect where a div increases in height, causing the divs beneath it to shift downward in a

My aim is to create columns of divs where the user can click on a div to see more content as the height expands. I've managed to set this up, but it seems there's an issue with the document flow. When I click on a div in the first column, the div ...

The functionality of the click event attached with the addEventListener is

I have a unique project where I am developing a user interface for a paper-rock-scissor game. To create the UI, I included four buttons: "Start game," "rock," "paper," and "scissor." Initially, I wrote separate code for each button, which worked perfectly ...

The detailView feature in wenzhixin bootstrap-table is failing to initialize the child row

I am currently utilizing the wenzhixin bootstrap table and attempting to initialize another bootstrap table within a child row known as 'detailView' in the code. Previously, I was using datatables but found this method to be simpler and more dir ...

Display a dynamic variable within React's HTML code

const fetchTime = () => { const currentDate = new Date(); const currentTime = currentDate + ' ' + currentDate.getHours() + ":" + currentDate.getMinutes() + ":" + currentDate.getSeconds(); return {currentTime}; } export default fun ...

The Bootstrap carousel controls now add the carousel ID to the address bar instead of just moving to the next slide

I can't figure out why my carousel isn't working. The id of the carousel is showing up in the webpage's address, which usually happens when the 'bootstrap.js' file is missing, but I have included it. Can anyone help me troubleshoo ...

Is there a method to incorporate a scroll event into the ng-multi-selectdropdown, a npm package?

Query: I need to incorporate a scroll event in the given html code that triggers when the div is scrolled. However, I am facing issues with implementing a scroll event that works when the elements are being scrolled. <ng-mult ...

What is the typical output value that fluctuates?

I only have one input to work with. My goal is to set the input value to "5", then display "3" in the "total" field and "4" in the "total2" field. Additionally, for every increment of +1 to the input value, I want the "total" and "total2" fields to also in ...

Designing HTML Emails Using Nested Tables

Why is my text-decoration="none" not displaying properly? I have tried placing it in various locations like table, tr, td, but I am unable to make it work. Are there any common mistakes when styling email designs? Here is the code snippet: <table cel ...

Generating Dynamic Widgets Within the Document Object Model

Currently, I am working with jQuery Mobile 1 alpha 1. In order to create a text input field using jQuery Mobile, you need to include the following HTML code: <div data-role='fieldcontain'> <label for='name'>Text Input:</ ...

Troubleshooting: Vue.js Component template not displaying items with v-for loop

I recently implemented a method that calls an AJAX request to my API and the response that it returns is being assigned to an array. In the template section, I am using the v-for directive to display the data. Surprisingly, it only renders once after I mak ...

Refreshed page causing hide/show div to reset

Hello there, I'm currently working on a web application and I need to implement some JavaScript code. The application consists of three sections, each with its own title and button. When the button is clicked, a hidden div tag is displayed. Clicking t ...

Having trouble making SCSS mixins work with CSS variables in NextJS?

My current next.config.js setup looks like this: module.exports = (phase, {defaultConfig}) => { if ('sassOptions' in defaultConfig) { defaultConfig['sassOptions'] = { includePaths: ['./styles'], ...

From Button to Picture Button

Having an issue with my dropdown menu. After selecting a location, clicking on the "go" button should direct me to another page. Here is the HTML code for the button: <input type="button" name="button" class="gobutton" onclick="openDir(this.form);"> ...

Choose the specific Element by its dynamicID in JQuery

Just starting out with Jquery and I have a specific task in mind. In my HTML page, I have elements with IDs generated by concatenating a string variable. My goal is to use JQuery to select the element with this dynamically generated ID. See below for more ...