I'm new to Wordpress but I'm trying to create a green squint colored box behind a line of text. Just like in the demo website here but using Gutenberg instead of Elementor.
It would be great if it could be re-used later on. What I tried so far was to follow the steps in this tutorial:
- Create a parallelogram here
- In WordPress add the name "shapeone" to the
Cover
object in "Additional CSS classes" - Click "Preview" in WordPress, then "Customize" and add the custom CSS from the shape in "Astra > Customizing > Additional CSS":
.shapeone {
clip-path: polygon(25% 0%, 100% 0%, 75% 100%, 0% 100%);
}
How is it possible to add this green colored box behind the text? And make it move with the text and not cut of the text?
You can achieve it with using pseudo-element before. Here is some sample code:
You can see it in action here - https://codepen.io/lukaszpiotrluczak/pen/mdKzrva
So to conclude:
position: relative
::before
element and give itposition: absolute
,content: ""
andz-index: -1
left
,right
,top
,bottom
background-color
andclip
Of course there is a chance you will need to play with z-index etc.
If you provide link to page I can give you exact css to put.