If I put "NEWS & EVENTS", the ‘EVENTS’ will disappear.
But if I change ‘&’ to ‘#’, it works fine. How can I use ‘&’ without causing text disappearing
.title {
width: 1438px;
height: 142px;
left: 94px;
top: 201px;
font-family: "Eurostile";
font-style: normal;
font-weight: 900;
font-size: 180px;
line-height: 78.8%;
/* identical to box height, or 142px */
text-align: center;
text-transform: uppercase;
background: linear-gradient(95.99deg, #CE9B58 25.39%, #FFEC83 73.41%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
<div class="background">
<h1 class="title">NEWS & EVENTS</h1>
<h1 class="title">NEWS # EVENTS</h1>
</div>
2
Answers
You need to escape special characters in HTML. Try this instead:
&
;The & is wider than the #, so you can simply increase the width of your .title:
The width, height, top, left and font-style probably aren’t necessary: