Search code examples
htmlcssangularsassborder

I want to achieve half border on right side of div as shown in image


I want to achive as shown below in comps image link. Comps Image

My html structure is something like this

<div class="module-box carilion-proud-logo-section">
    <div class="left-section">
        <svg>Carilion Proud Logo svg</svg>
    </div>
    <div class="right-section">
        <a href="">Visit the hub</a>
    </div>
</div>

My CSS structure is something like this

.carilion-proud-logo-section {
  margin: 0 30px 30px 30px !important;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #e0e0e0;
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  border-radius: 5px;
  .left-section {
    text-align: center;
    width: 100%;
    padding: 39px 0;
    background: url("../../../../../../assets/images/carilion-proud-blue.png")
      no-repeat center;
    background-size: cover;
    clip-path: ellipse(100% 150% at 0% 50%);
    border-radius: 5px;
  }
  .right-section {
    // padding: 39px 0;
    width: 100%;
    text-align: center;
    align-self: center;
  }
}

The only issue is image should not have border and rest div element should have border


Solution

  • the simpliest might be to use an inset shadow: here is an example :

    div {
      box-shadow: inset 0 0 0 3px gray;
      /* makeup for demo */
      display: flex;
      width: 500px;
      border-radius: 1em;
      overflow: hidden;
      margin: 2em auto;
    }
    button {
      margin: auto;
    }
    <div><img src="https://picsum.photos/id/16/250/100"> <button>button</button></div>

    The shadow draws a border but is hidden behind the image.