感谢您的支持,我会继续努力的!
打开微信扫一扫,即可进行扫码打赏哦
点我查看本站打赏源码!
Powered by RUNCODEX.COM,学的不仅是技术,更是梦想!!!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>文档标题</title>
</head>
<body>
<h1>伪类:host</h1>
<div class="host">
<p>Old Name: Chen, Gangsheng</p>
<span class="name">New Name: Jackie Chen</span>
<h3>Movie Star</h3>
</div>
<template class="root-template">
<style>
:host { color: red; border: 1px solid red; }
:host(*){ color: orange; }
</style>
<p><content select=".name"></content></p>
<p><content select=""></content></p>
<h4>Oscar winner</h4>
</template>
</body>
</html>
<script>
var host = document.querySelector('.host');
var root = host.createShadowRoot();
var template = document.querySelector('.root-template');
root.appendChild(template.content);
</script>
输入 JavaScript 代码……
xxxxxxxxxx
输入 CSS 代码……