如何在不使用css的情况下使HTML锚定标记在悬停时更粗体,只更改内联样式?

如何在不使用css的情况下使HTML锚定标记在悬停时更粗体,只更改内联样式?,html,hover,Html,Hover,我试图使以下锚定标记在悬停时看起来更粗体,而不使用任何外部或嵌入的CSS文件,我可以通过应用内联样式使它们看起来更粗体吗 <a href="https://en.wikipedia.org/wiki/Internet_of_Things" target="_blank" ">Internet of things<br></a> <a href="https://en.wikipedia.org/wiki/Machine_to_machine" tar

我试图使以下锚定标记在悬停时看起来更粗体,而不使用任何外部或嵌入的CSS文件,我可以通过应用内联样式使它们看起来更粗体吗

<a href="https://en.wikipedia.org/wiki/Internet_of_Things"  target="_blank" ">Internet of things<br></a>
<a href="https://en.wikipedia.org/wiki/Machine_to_machine"  target="_blank">M2M<br></a>
<a href="https://en.wikipedia.org/wiki/Mesh_networking"  target="_blank">Mesh Network<br></a>
<a href="https://en.wikipedia.org/wiki/Telemetry"  target="_blank">Telemetry<br></a>
<a href="https://en.wikipedia.org/wiki/Wireless_sensor_network"  target="_blank">WSN</a>

根据这一点,没有:

但是您可以使用javascript,使用
onmouseover
event

根据这一点,不:


但是您可以使用javascript,使用
onmouseover
event

来完成这项工作,而不能使用内联CSS。您必须使用普通的
标签或单独的工作表:

a {
    font-weight: normal;
}

a:hover {
    font-weight: bold;
}
我强烈建议您尝试使用CSS,但如果您必须使用JS,这里有一个解决方案:

<a href="https://en.wikipedia.org/wiki/Internet_of_Things" onmouseover="this.style.fontWeight='bold'" onmouseout="this.style.fontWeight='normal'" target="_blank" ">Internet of things<br></a>

这是一把小提琴:


内联CSS无法实现这一点。您必须使用普通的
标签或单独的工作表:

a {
    font-weight: normal;
}

a:hover {
    font-weight: bold;
}
我强烈建议您尝试使用CSS,但如果您必须使用JS,这里有一个解决方案:

<a href="https://en.wikipedia.org/wiki/Internet_of_Things" onmouseover="this.style.fontWeight='bold'" onmouseout="this.style.fontWeight='normal'" target="_blank" ">Internet of things<br></a>

这是一把小提琴:


请将代码缩进四个空格以正确显示格式。请将代码缩进四个空格以正确显示格式。非常感谢,对我这样的初学者非常有帮助。当然。再次,我建议你改用CSS方式(更新了帖子)非常感谢你,对我这样的初学者非常有帮助。当然。同样,我建议你改用CSS方式(更新了帖子)