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:
- Add a text element to your Webflow project by selecting the element type "Text" from the elements panel on the left-hand side.
- Customize the text element's content, font, size, and color according to your preferences using the style panel on the right-hand side.
- 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.
- With the text element selected, navigate to the "Custom Code" tab in the style panel.
- Click on the "+" button to add a new custom code block and select "Before Head Tag" from the "Embed Code Position" dropdown.
- 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>
- Replace
.your-class-name
in the above code with your actual class name from step 3. - Adjust the border width and color by modifying the
border
property in the CSS code. - 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:
- How can I create transparent text in Webflow?
- What are pseudo-elements in CSS, and how can I use them in Webflow?
- How do I apply custom CSS code in the Webflow designer?