【发布时间】:2021-04-24 09:38:52
【问题描述】:
我试图使用 gif 作为示例中显示的文本的背景,但是当文本向右对齐时,它变得透明。知道这是否可以解决?
.team {
font-family: "Poppins", sans-serif;
width: 100%;
border: none;
font-size: 2rem;
text-transform: uppercase;
text-align: left;
font-weight: 600;
background-image: url(https://media1.giphy.com/media/3oGRFmtqXJogGVcz6g/giphy.gif);
color: transparent;
background-clip: text;
-moz-background-clip: text;
-webkit-background-clip: text;
}
<center>
<input class="team" type="text" placeholder="Align Left" value="This works fine" />
<input class="team" style="text-align: right;" type="text" placeholder="Try me" />
<input class="team" style="text-align: center;" type="text" placeholder="Align Center" value="This also works fine"/>
</center>
【问题讨论】:
-
该错误不仅与文本对齐有关,而且当您输入长单词时(触发溢出时)也存在
标签: css webkit background-image text-align