Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Header with curved pointed bottom

I need to create the bluey/green area that is shown in the picture below. It has angled sides coming down to a point that has a slight curve.

What is the best way to achieve this using CSS? I need to support IE9+ or IE10+ if IE9 support is not possible.

I have started a basic demo here - (Don't need the content within the bluey-green area)

header with curved pointed bottom

like image 565
ifusion Avatar asked Apr 03 '16 23:04

ifusion


People also ask

Can I create a div with a curved bottom?

Yes, you can do this in CSS - basically make your div wider than the page to fix the too-rounded edges, then left-positioned to compensate, with bottom border radius using both x & y values, and negative bottom margin to compensate for the gap: .

How do you make a bottom curve in CSS?

CSS Syntaxborder-bottom-left-radius: length|% [length|%]|initial|inherit; Note: If you set two values, the first one is for the bottom border, and the second one for the left border. If the second value is omitted, it is copied from the first. If either length is zero, the corner is square, not rounded.


2 Answers

Here's my attempt with css only:

.header {
  background: #415d67;
  height: 150px;
  position: relative;
  z-index: 1;

}
.header:after {
    position: absolute;
    content: "";
    background: #415d67;
    width: 50%;
    bottom: -20px;
    right: 0;
    height: 100%;
    transform: skewY(-5deg);
    transform-origin: right;
    border-bottom-left-radius: 50px;
    padding-right: 44px;
    z-index: -1;
}
.header:before {
    position: absolute;
    content: "";
    background: #415d67;
    width: 50%;
    bottom: -20px;
    left: 0;
    height: 100%;
    transform: skewY(5deg);
    transform-origin: left;
    border-bottom-right-radius: 50px;
    padding-left: 44px;
    z-index: -1;
}
.content {
  background: white;
  padding: 20px;
  padding-top: 100px;
}

JSBIN demo

You can also consider using an svg graphic.

like image 185
seahorsepip Avatar answered Sep 18 '22 20:09

seahorsepip


Another approach would be to use an inline svg. The following example uses a path element with a bezier curve command for the bottom curve :

#header {
  position: relative;
  padding: 30px;
  text-align: center;
  color: #fff;
}
#header svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}
<div id="header">
  <svg viewbox="0 0 100 20" preserveAspectRatio="none">
    <path fill="#415D67" d="M0 0 H100 V10 L52.5 19.5 Q50 20 47.5 19.5 L0 10z" />
  </svg>
  <p>Some content</p>
</div>
<p>some more content</p>
like image 27
web-tiki Avatar answered Sep 20 '22 20:09

web-tiki