Skip to content

No. 1

Live Preview 💛

Source Code

html
<div class="tcss--wrapper">
  <div
    class="tcss--background"
    style="background-image: url('https://assets.codepen.io/4926399/DSCF5648.jpg')"
  ></div>
  <div class="tcss--front">
    <div class="tcss--title">Tokyo skyline</div>
    <div class="tcss--sub-title">
      <div class="tcss--sub-title__text">moody urban landscape</div>
      <div class="tcss--sub-title__text">
        city lights in twilight atmosphere
      </div>
      <div class="tcss--sub-title__text">pink sunset</div>
    </div>
  </div>
</div>
css
/* Fonts */
@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap");

body {
  margin: 0;
  font-family: "Montserrat", sans-serif;
}

.tcss--wrapper {
  position: relative;
  width: 100%;
  height: 100svh;
}

.tcss--background {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.tcss--background:before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.2);
}

.tcss--front {
  position: absolute;
  left: 50%;
  top: 35%;
  transform: translate(-50%, -50%);
  width: max-content;
}

.tcss--title {
  color: white;
  font-weight: 800;
  font-size: max(60px, min(7vw, 150px));
  letter-spacing: 4px;
  text-align: center;
  margin-bottom: 1.5rem;
}

.tcss--sub-title {
  display: flex;
  color: white;
  font-weight: 300;
  letter-spacing: 1px;
  justify-content: center;
}

.tcss--sub-title__text {
  position: relative;
  padding-right: 1rem;
  margin-right: 1rem;
}

.tcss--sub-title__text:before {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 1px;
  background-color: white;
}
.tcss--sub-title__text:last-child:before {
  display: none;
}

@media (max-width: 992px) {
  .tcss--front {
    left: 10%;
    top: 15%;
    transform: none;
    width: 90%;
  }

  .tcss--title {
    margin-bottom: 1.5rem;
    text-align: left;
  }

  .tcss--sub-title {
    flex-direction: column;
    margin-bottom: 1.5rem;
  }

  .tcss--sub-title__text {
    padding-left: 1rem;
    padding-right: 0;
    margin-right: 0;
    margin-bottom: 0.5rem;
  }

  .tcss--sub-title__text:before {
    content: "";
    position: absolute;
    right: auto;
    left: 0;
    background-color: white;
  }
  .tcss--sub-title__text:last-child:before {
    display: block;
  }
}

CodePen