不同html标记的不同光标指针
我正在努力渲染不同html标记的不同光标指针,html,css,Html,Css,我正在努力渲染 if(path == "not supported") { return $('<p>',{"class" : "color-black font13_20"}).text(path); } else { return $('<a>',{"class" : "wrap-text-span getWidthP color-ublue font13_20", "href": path, "target":"_
if(path == "not supported") {
return $('<p>',{"class" : "color-black font13_20"}).text(path);
}
else {
return $('<a>',{"class" : "wrap-text-span getWidthP color-ublue font13_20", "href": path, "target":"_blank"}).text(path);
}
if(路径==“不受支持”){
返回$(“”,{“class”:“color black font13_20}).text(路径);
}
否则{
返回$('',{“类”:“包装文本跨距getWidthP颜色ublue font13_20”,“href”:路径,“目标”:“_blank”}).text(路径);
}
这为我提供了所需的结果,如果路径不受支持,我会得到一个黑色的
,没有超链接,而如果路径不受支持,我会得到一个蓝色的超链接。但在这两种情况下,我都得到指针类型的游标。我希望在if块中使用默认光标,在else中使用指针光标。将以下规则添加到CSS中
p.color-black {
cursor: not-allowed;
}
a.color-ublue {
cursor: pointer;
}
出于某种原因,p标记从父元素继承光标样式。因此,您需要将其设置回默认行为
p {
cursor:auto;
}
或者在p标记中应用了类:
.reset-cursor {
cursor:auto;
}
检查这个,如果它对你有用
if(path == "not supported") {
return $('<p>',{"class" : "color-black font13_20",/*use inline css style here for cursor -> style="cursor:auto;"*/}).text(path);
}
else {
return $('<a>',{"class" : "wrap-text-span getWidthP color-ublue font13_20", "href": path, "target":"_blank"}).text(path);
}
if(路径==“不受支持”){
返回$(“”,{“class”:“color black font13_20”,/*在这里为游标使用内联css样式->style=“cursor:auto;”“*/}).text(path);
}
否则{
返回$('',{“类”:“包装文本跨距getWidthP颜色ublue font13_20”,“href”:路径,“目标”:“_blank”}).text(路径);
}
我不知道你使用的语言的编码惯例。。所以你自己做吧。。。我已经添加了要添加的位置和内容。。。。。。这可能会解决您的问题…也许,在不支持的消息中添加一个唯一标识符,然后使用css
光标:default
?不支持时呈现的html实际上是什么样子的?您的CSS中没有.font1320{cursor:…
,是吗?@love2code其中一个答案回答了您的问题吗?