CSS Background-clip Text

Web Design & Web Development

Demo

Sponsored links

 

Code

HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Background-clip Text</title>
    <link rel="stylesheet" type="text/css" href="https://demo.plantpot.works/assets/css/normalize.css">
    <link rel="stylesheet" href="https://use.typekit.net/opg3wle.css">
    <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
    <div id="container">
      <p>Background-clip</p>
      <h1 class="bg-cliped-text">TEXT</h1>
    </div>
  </body>
</html>

CSS

@charset "utf-8";
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
}
body {
  background-color: #000416;
  font-family: futura-pt, sans-serif;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}
#container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
}
.bg-cliped-text {
  margin: 0;
  font-weight: 500;
  font-size: 12rem;
  letter-spacing: 10px;
  background-image: url(bg.jpg);
  background-position: top left;
  background-size: cover;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
p {
  width: 100%;
  padding: 5px;
  background-color: #fff;
  color: #000416;
  font-weight: 500;
  font-size: 2.5rem;
  letter-spacing: 8px;
  text-align: center;
}
@media screen and (max-width: 480px) {
  .bg-cliped-text {
    font-size: 7rem;
    letter-spacing: 4px;
  }
  p {
    font-size: 1.75rem;
    letter-spacing: 2px;
  }
}