ftramnitzke
ftramnitzke

Reputation: 161

html button with custom corners

I'm currently designing a navigation bar for a website using Bootstrap. There is a main navigation bar and a second one directly under the first, see image:

enter image description here
I managed to round the corners of the button bottom with simple CSS but for the top corners I'd like to achieve something like this:

enter image description here
Is there a way to do this in CSS/jQuery or with an additional plugin?

EDIT:

HTML for the button is:

<button type="submit" class="btn navbar-btn second-navbar-button">
    <span class="mdi mdi-eye second-navbar-icon"></span>
    <span class="second-navbar-name">&nbsp;Overview</span>
</button>

The CSS for the button looks like the following

.second-navbar-button {
  font-size: 26px;
  border: none;
  background-color: transparent;
  color: #ec9f14;
  margin: 0 19px 0 19px;
  padding: 0px 8px 0px 8px;
  border-top-left-radius: 0px;
  border-top-right-radius: 0px;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;}

There is space between the buttons so manipulating the corners of the adjacent button won't work, afaik.

Cheers,

Trammy

Upvotes: 4

Views: 1023

Answers (1)

Pedram
Pedram

Reputation: 16615

See this example:

.button{
    border:1px solid red;
    border-bottom:0;
    width:80px;
    height:40px;
    margin:30px;
    position:relative;
    -moz-border-radius:5px 5px 0 0;
    -webkit-border-radius:5px 5px 0 0;
}
.button:after,
.button:before{
    content:'';
    width:40px;
    height:30px;
    border:1px solid red;
    position:absolute;
    bottom:-3px;
    border-top:0;
}
.button:after{
    border-left:0;
    -moz-border-radius:0 0 5px 0;
    -webkit-border-radius:0 0 5px 0;
    left:-41px;
}
.button:before{
    border-right:0;
    -moz-border-radius:0 0 0 5px;
    -webkit-border-radius:0 0 0 5px;
    right:-41px;
}
<div class="button">text</div>

Upvotes: 1

Related Questions