Make an element rotated & overflow to top + rounded inside border

Viewed 69

I have two problems :

  1. How to make the text container rotated in front of background and cut its top like this example. My current approach make it overflow the bottom of the background :

https://codepen.io/fadhilradh/pen/wvdZPEE

.wrapper {
 background-image: linear-gradient(
    to right,
    #00dbde,
    #00cfff,
    #00b8ff,
    #6a8cff,
    #fc00ff
  );
  height: 800px;
  width: 100%;
}

.banner {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px;
  background: black;
  border-radius: 12px;
  border: 20px solid white;
  height: 80%;
  width: 100%;
  font-family: "Source Code Pro";
  transform: rotate(-30deg);
  margin-top: -300px;
}
<div class="wrapper">
      <div class="banner"/>
</div>

  1. How to make the inside border rounded like the example.

I really appreciate if you can help me

2 Answers

enter image description here Possibly something like this?

body {
  overflow: hidden;
}

.wrapper {
 background-image: linear-gradient(
    to right,
    #00dbde,
    #00cfff,
    #00b8ff,
    #6a8cff,
    #fc00ff
  );
  height: 800px;
  width: 100%;
}

.banner {
  color: #35C222;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 16px;
  background: black;
  border-radius: 50px;
  border: 30px solid white;
  height: 70%;
  width: 100%;
  font-family: "Source Code Pro";
  transform: rotate(-30deg);
  margin-top: -300px;
}

.frontend {
  font-size: 70px;
  margin-bottom: 0;
  margin-left: 100px;
}

.time {
  transform-origin: bottom left;
  transform: rotate(90deg) translate(-80%);
}
<div class="wrapper">
      <div class="banner">
        <p class="time">{time.format("MMMM Do YYYY, h:mm:ss")}</p>
        <p class="frontend"> &#60; SPE / Frontend &#62; </p>
      </div>
</div>

  1. Add following lines to the CSS
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box;
}
  1. Just make sure that the border is smaller than the border-radius.
Related