How can I make text transparent in the middle with a thick black outline in Webflow?

Published on
September 22, 2023

To make text transparent in the middle with a thick black outline in Webflow, you can use a combination of CSS properties and pseudo-elements. Follow these steps to achieve the desired effect:

  1. Add a text element to your Webflow project by selecting the element type "Text" from the elements panel on the left-hand side.
  2. Customize the text element's content, font, size, and color according to your preferences using the style panel on the right-hand side.
  3. Once the text element is styled, give it a class name by clicking on the "Selector field" in the style panel and entering a class name of your choice.
  4. With the text element selected, navigate to the "Custom Code" tab in the style panel.
  5. Click on the "+" button to add a new custom code block and select "Before Head Tag" from the "Embed Code Position" dropdown.
  6. Inside the custom code block, paste the following code:
<style>  .your-class-name {    position: relative;  }  .your-class-name::after {    content: '';    position: absolute;    top: 50%;    left: 50%;    transform: translate(-50%, -50%);    width: 100%;    height: 100%;    border: 4px solid #000;    opacity: 0.75;    pointer-events: none;    z-index: 1;  }</style>
  1. Replace .your-class-name in the above code with your actual class name from step 3.
  2. Adjust the border width and color by modifying the border property in the CSS code.
  3. To control the transparency of the middle part, adjust the opacity property value. 1 represents full opacity, while 0 represents completely transparent.

By following these steps, you will be able to make text transparent in the middle with a thick black outline in Webflow.

Additional questions:

  1. How can I create transparent text in Webflow?
  2. What are pseudo-elements in CSS, and how can I use them in Webflow?
  3. How do I apply custom CSS code in the Webflow designer?