Here is the example where apply css via JavaScript
<script>
const mstyle = document.head.appendChild(document.createElement(‘style’));
style.textContent = /*this is the css*/`
.myclass {
aspect-ratio: 16 / 9; background-color: #000;
position: relative; display: block; contain: content;
background-position: center center;
background-size: cover;
}
#mydivid {
color:green; opacity: 0;
}
`;
</script>
Sunday, March 10, 2024
Apply CSS via JavaScript
Add Dependent Scripts
here is the code that allow to add dependent script : <script> const addDependentScripts = async function( scriptsT...
0 comments:
Post a Comment