I am trying to modify the "left" attribute of a pseudo-element :before
. I am having no trouble modifying any other elements using either JavaScript or jQuery, but seem to be stuck when trying to modify an element in the :before
tab.
By way of example, I cant seem to set the left
attribute of the :before
element below to 200
.
My css:
#buttonBox {
position: absolute;
width:150px;
z-index:10;
left:298px;
top: 130px;
}
#buttonBox:before {
position: absolute;
content: "";
top: -8px;
left: 80px;
margin-left: -8px;
border-bottom: 8px solid #ddd;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-top: 0;
border-bottom-color: #1e2227;
}
In javascript:
document.getElementById("#buttonBox:before")
yields null
, making it impossible to set that.
jQuery:
$("#buttonBox:before").offset({top: -8, left: 200});
is similarly unresponsive in setting the left
attribute.
Is there something I am missing on how to modify attributes of pseudo-elements? I'm not having any luck Googling this one.