I am trying to create the following in my WordPress images/posts.
I need it to be responsive as well so I am using Bootstrap 3 and Background images.
Code snippet for posts:
<div class="row">
<div class="col-md-4">
<h1>Title</h1>
<p>content goes here</p>
</div>
<div class="col-md-8" style="background-image:url('<?php echo $thumbnail_url ?>');">
</div>
</div>
The background-image:url
just gets featured image from the post and puts it as a background.
I’m looking to get that masked arrow, or at least fake it.
Use pseudo-elements and transparent borders to fake it
In this example, two empty boxes are added to
.image
using::before
and::after
pseudo-elements.The boxes are transparent, so are all of its borders except on one-side. Each is positioned so that they stretch along one half of one side of the container with their edges touching.
A triangular shape is formed where the corners of the borders meet.
The
.image
container has a border of the same style set on all sides except the one where the pseudo-boxes are positioned, which completes the illusion of a clipping mask with an arrow notched into one side.A media query is used to change the position of the pseudo-elements and recolor the borders along a different edge.
Hint: View “Full page” and change your viewport size to see the media query in action.