HandsomeTan
Posted on November 27, 2024
Today I used CSS2DObject in a Vue project, but css styles didn't work on this CSS2DObject. After searching for some information, I found this problem is casued by scoped
syntax sugar. Let's review the essence of scoped
syntax sugar:
<style scoped>
.className {
...
}
</style>
after compilation, the codes above can be displayed as follows:
<style scoped>
.className[data-v-hash] {
...
}
and all elements in vue component have added data-v-hash attribute, except for elements we created by ourselves, so css styles with scoped
syntax sugar do not work on these elements.
💖 💪 🙅 🚩
HandsomeTan
Posted on November 27, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
javascript The 1 Software Tool/App I Can’t Live Without For Doing 3D Web Development
August 15, 2024