Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get the value of css pseudo properties js

<div class="element"> This is my element </div>

.element { background-color: red }
.element::before { content: "Before pseudo element"; }

const element = document.querySelector('.element')
pseudoElementStyle = getComputedStyle(element, '::before')

console.log(pseudoElementStyle.content) // Before pseudo element
Source by zellwk.com #
 
PREVIOUS NEXT
Tagged: #css #pseudo #properties #js
ADD COMMENT
Topic
Name
7+6 =