如何设置包含before属性的元素的左侧位置?
我尝试过以下几种方法但没有成功:
$(".tooltip:before").css({left: 80});
$(".tooltip::before").css({left: 80});
这是css,如果它有帮助
.tooltip {
background-color:#333;
display: block; position: absolute; z-index: 999999; padding: 5px 10px;
color: #fff;
}
// create the tip of the tooltip
.tooltip:before {
border: solid; border-color: #333 transparent; border-width: 6px 6px 0 6px;
position: absolute; bottom: -6px;
z-index: 9999999;
content: "";
left: 0; /* use jQuery to center the tip depending on the size of the tooltip */
}