1
Hello, a curious bug appeared when I tried to make a text with this effect:
The problem is in smaller screens, the second effect in the text "adipiscing Elit!" simply add up, depending on the size the two disappear, as shown in the image below:
AMENDING: Analyzing I realized that the problem is breaking the word with the effect, Is there any way around this?
Below is the example of the code.
To play just decrease the viewport of your browser.
.color-primary {
color: #225cbe;
}
.featured-text {
position: relative;
font-weight: 900;
}
.featured-text:after {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 35%;
background-color: #fdd104;
z-index: -10;
}
<div class="main-title">
<p class="color-primary ">
<span class="featured-text">
Lorem Ipsum,
</span> dolor amit.
</p>
<p class="color-primary">
Consectetur,
<span class="featured-text">
adipiscing elit!
</span>
</p>
</div>
I used inline-block as it is a project that won’t take long I won’t have to worry about so many details.
– MSLacerda
@Mslacerda is a functional solution, but it is not yet the perfect solution, that is if there is a perfect rss solution. But in the test that I did, if the screen is extremely small, you still run the risk of bugging, I believe that will not be your case... Up to pq if it is an extended text within this span will take even with the
inline-block
... Particularities of the CSS :/– hugocsl
I believe that I do not have a perfect solution, until pq do this effect in text only with css requires these "hacks" and this alone is already a problem, but the text is small and only appears once, then this alternative solution will solve.
– MSLacerda