javascript - 如何将超链接与 javascript 或 css 分开设置?
问题描述
如何将超链接与 javascript 或 css 分开设置?但我不想为每个人创建一个新的类或 id。在我问这个问题之前我已经尝试过搜索,但我不知道正确的终端,对不起我的英语不好
编辑:
我的意思是,对于 2 个超链接(例如,点就是区别):
<a href=https://www.google.com>google</a>
<a href=www.google.com>google, no http</a>
样式不同,但前提是超链接类型不同
解决方案
您可以通过像这样应用元素级 css 来简单地做到这一点
a {
color: red;
font-weight: bold;
}
<div>
<p>Normal Text</p>
<p><a href="#"> This is hyperlink </a></p>
<p><a href="#"> This is another hyperlink </a></p>
<p><a href="#"> This is another hyperlink </a></p>
<p> <a href="#"> This is another hyperlink </a></p>
<p><span> Normal Text</span></p>
</div>
推荐阅读
- css - 溢出滚动隐藏但不是内容
- python - 在子任务中创建的异步子进程,任务始终挂起
- python - 如何在 Flask 中打开和处理 .rtf 文件
- linux - 为多实例 VM vSphere 部署配置置备脚本
- yaml - 使用 yq 编辑 yaml 文件(--in-place, -i 标志)
- c++ - Visual Studio Code C++ 包含路径
- python - 根据在 TKinter 中单击的单选按钮显示选择之间的标签?
- cluster-analysis - 使用非线性混合效应建模进行聚类
- reactjs - react-router-dom 的链接更新 URL 而不渲染组件
- python-3.x - 如何使用 Python lxml 和 xpath 解析此 html 以找到特定跨度 id 的父表?