0

I'm trying to create a web element like this, but am having trouble figuring out how to make a curved border between two divs. I understand the functionality of border-radius (very bad implementation in codepen below), bit wanted to see if anyone had ideas on how to implement the picture above? I thought about having a border-radius with a much larger radius, then hiding overflow, but not sure if that makes sense.

https://codepen.io/unsure-of-name/pen/LYeBdbX

.circle {
  height: 100px;
  width: 100px;
  background-color: #eee;
  border-radius: 100px;
  box-shadow: 0 0px 8px 0 rgba(0, 0, 0, 0.2), 0 0px 20px 0 rgba(0, 0, 0, 0.19);
  display: inline-block;
  vertical-align: top;

  position: relative;
  z-index: 2;
}

.bar {
  display: inline-block;
  margin-top: 25px;
  background-color: #eee;
  margin-left: -50px;
  padding-left: 50px;

  height: 50px;
  text-align: center;

  positive: relative;

  z-index: 1;
}

.bar div:nth-child(1) {
  background-color: red;
  border-radius: 10px;
}

.bar div:nth-child(2) {
  background-color: #bbb;
}

.bar div:nth-child(3),
.bar div:nth-child(4) {
  background-color: #eee;
  border-right: 1px solid black;
}

.bar div {
  display: inline-block;
  vertical-align: middle;

  text-align: center;
  line-height: 50px;
}

.row {
}

.row > div {
}
<div class='container'>
  <div class='row'>
    <div class='circle'>
      
    </div>
    <div class='bar'>
      <div>
        Group 1
      </div>
      <div>
        Description
      </div>
      <div>
        Cell 1
      </div>
      <div>
        Cell 2
      </div>
    </div>

  </div>

  <div class='row'>
    <div class='circle'>
      
    </div>
    <div class='bar'>
      <div>
        Group 1
      </div>
      <div>
        Description
      </div>
      <div>
        Cell 1
      </div>
      <div>
        Cell 2
      </div>
    </div>

  </div>

</div>

Thanks!

thomas
  • 1

2 Answers2

0

That's some very confusing css you have written. The css below will get you what you want. You still have to organize the rest of it. Hope this helps.

.row{
  display: flex;
  align-items: center;
}

.bar {
  display: inline-block;
  background-color: #eee;
  margin-left: -50px;
  padding-left: 50px;

  height: 50px;
  display: flex;
  text-align: center;

  positive: relative;

  z-index: 1;
}

.bar div{
  padding: 0 10px;
  width: 100px;
}

.bar div:nth-child(1) {
  position: relative;
  background: red;
  color: black;
  height: 50px;
}

.bar div:nth-child(1)::before{
  content: '';
  width: 20px;
  height: 100%;
  position: absolute;
  bottom: 0;
  right: -5px;
  background: red;
  border-radius: 100%;
}
Rakib Uddin
  • 880
  • 1
  • 6
  • 17
0

You can try using ellipse to define the how 'curvy' the side should look

#box1 {
  background: red;
  width: 10rem;
  height: 3rem;
 
  padding: 0.5rem;
  clip-path: ellipse(10rem 7.5rem at left);
 
}

.wrapper {
  background: blue;
  width: 20rem;
 
}
<div class="wrapper">
  <div id="box1">
    
  </div>
 
</div>
joohong89
  • 1,241
  • 8
  • 15