css 添加URL链接到HTML选取框

xjreopfe  于 2023-04-01  发布在  其他
关注(0)|答案(2)|浏览(115)

我是新的编码,并试图找出如何添加一个链接到我的字幕。我也想有没有颜色变化或下划线动画。任何建议?

.Marquee {
  color: #da6fe2;
  background-color: transparent;
  font-family: work sans;
  font-size: 34px;
  line-height: 50px;
  padding: 0px;
  font-weight: bold;
}
<marquee class="Marquee" direction="right" scrollamount="4" behavior="scroll">HELLO &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HELLO &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HELLO &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HELLO &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HELLO</marquee>

我试图添加,但由于某种原因,它覆盖的风格,当我这样做。

qgzx9mmu

qgzx9mmu1#

简单的解决方案是,您可以将marquee标记放在<a>标记中。

.Marquee {
  color: #da6fe2;
  background-color: transparent;
  font-family: work sans;
  font-size: 34px;
  line-height: 50px;
  padding: 0px;
  font-weight: bold;
}
<a href = "https://stackoverflow.com"><marquee class="Marquee" direction="right" scrollamount="4" behavior="scroll">HELLO &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HELLO &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HELLO &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HELLO &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HELLO</marquee></a>
2w2cym1i

2w2cym1i2#

你可以通过添加这样的东西来实现:

<a href="http://www.google.com" 
   onmouseover="this.parentNode.stop()" 
   onmouseout="this.parentNode.start()">HELLO</a>
</marquee>

为了使链接不覆盖样式,您可以将此添加到样式:

.Marquee a {
       text-decoration:none;
       color: #da6fe2;
 }

一个二个一个一个

相关问题