HTML title 属性使 css :hover 不起作用

HTML title attribute making css :hover not work

我有一些制作箭头的代码,我正在尝试为其添加标题属性。这是箭头代码:

#arrow-right {
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 10px solid white;
}

#arrow-right:hover {
  border-left: 10px solid gray;
}
<div id="arrow-right" title="text here"></div>

在我添加 'title' 属性之前,它工作正常,在悬停时将颜色更改为灰色,但是在我添加 'title' 属性之后,css 颜色更改停止工作但是标题开始起作用了。有没有办法让这两个同时工作?

替换

<div id="arrow-right" ; title="text here"></div>

<div id="arrow-right" title="text here"></div>

我发现了问题。我有一些 js 在元素中声明样式,例如:

<div id="arrow-right" title="text here" style="border-right: 10px solid white;"></div>

连同样式表中声明的样式一起破坏了它。我只需要删除 thr div 中声明的样式并修复它