我想在我的文本下划线,因此在我的网页中添加一个来自github的javascript库。我知道还有其他选项可以在文本下划线,但我想使用这个库中漂亮的下划线。此外,不考虑下划线问题,我只是想知道如何使用这样一个github项目。我想添加这个库:https://github.com/wentin/underlineJS
我之前已经添加了库,但是始终提供了npm安装注释,或者.jar文件位于您可以使用的github主文件夹中(在Java,而不是Javascript中)。
通过查看github项目中的代码,我认为至少必须将这个脚本链接添加到我的标题中:
<link type="text/css" rel="stylesheet" href="css/underline.css" />然后将其添加到我的CSS中:
.underline {
position: relative;
}
.underline span {
pointer-events: none;
}
.underline canvas {
pointer-events: auto;
position: absolute;
top: 0;
left: 0;
/*background-color: rgba(222, 222, 222, 0.1);*/
/*z-index: -1;*/
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-o-user-select: none;
cursor: pointer;
}最后,在我的HTML中使用以下内容:
<a href="#" class="underline">at your gate</a>
<br>
<br>但这绝对没有效果..。
发布于 2020-08-04 12:26:32
您不能轻松地添加这个库,因为它只是一个技术演示。
引用:
尽管
这个名字很吸引人,但Underline.js只是一个技术演示。这意味着,如果不首先修改整个项目,就无法将其放到任何项目中。
来源:https://css-tricks.com/styling-underlines-web/#underline-js-canvas
https://stackoverflow.com/questions/63246704
复制相似问题