I'm trying to achieve a marker strike through effect, as shown in the image below.
I've tried wrapping the text in two span
elements. The inner one with negative top and bottom margins with the intent to reduce the height. The outer span
sets the background and has positive margins to compensate for for the negative margins of the inner span
. Similar to this question.
My current attempt doesn't function. This might be due to the fact that I'm using inline elements. However I don't want the whole block stroked but only the text inside the block.
.item .mark {
background-color: #ffd100;
margin: 13px 0;
}
.item .mark .text {
margin: -13px 0;
}
/* irrelevant CSS */
.item {
font-family: 'Open Sans', sans-serif;
font-size: 10pt;
text-align: center;
width: 200px;
}
.item h1 {
font-family: 'Permanent Marker', cursive;
font-size: 18pt;
font-weight: normal;
}
.item .button {
width: 40px;
height: 40px;
line-height: 40px;
margin: auto;
font-size: 14pt;
font-weight: bold;
border: 2px solid black;
border-radius: 40px;
}
.item .button:hover {
background-color: #ffd100;
}
.item .button a {
color: inherit;
text-decoration: none;
}
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Permanent+Marker&display=swap" rel="stylesheet">
<div class="item">
<h1><span class="mark"><span class="text">Foo</span></span></h1>
<p>
Jerky pastrami pork belly tongue bresaola. Flank t-bone tri-tip, leberkas
ribeye salami shoulder ball tip. Capicola frankfurter salami venison
turducken pig burgdoggen shankle drumstick tail fatback. Turkey pork ham
ball tip jowl beef rump boudin.
</p>
<div class="button"><a href="#">GO</a></div>
</div>
and– TimB Nov 15 '19 at 10:59-tags? I don't know about the visual effects of these, though (I'm blind).