webveuje/js/demo/dom.html
2021-03-23 10:58:10 +08:00

104 lines
2.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.gaibianzhuti{
color: white;
background-color: black;
width: 100px;
}
.biaoge{
width: 100px;
display: none;
}
.div1 {
border: 1px dashed black;
padding: 27px;
width: 350px;
height: 350px;
margin: 100px auto;
}
.div2 {
width: 300px;
height: 300px;
padding: 20px;
border: 5px solid #d7effe;
}
.div3 {
background-color: #ffa0df;
overflow: hidden;
}
.div4 {
margin: 40px;
border: 1px dashed white;
width: 218px;
height: 218px;
}
.div5 {
margin: 3px;
border: 1px dotted white;
width: 210px;
height: 210px;
}
.div6 {
margin: 49px;
border: 5px solid #fcff00;
width: 100px;
height: 100px;
background-color: #96ff38;
}
</style>
</head>
<body>
<div class="div1">
</div>
<script>
var div1 = document.getElementsByClassName("div1")[0];
var d2=document.createElement('div')
d2.setAttribute('class','div2')
div1.append(d2);
var d3=document.createElement('div')
d3.setAttribute('class','div3')
d2.append(d3);
var d4=document.createElement('div')
d4.setAttribute('class','div4')
d3.append(d4);
var d5=document.createElement('div')
d5.setAttribute('class','div5')
d4.append(d5);
var d6=document.createElement('div')
d6.setAttribute('class','div6')
d5.append(d6);
</script>
</body>
</html>
<!--
html
head
title
meta
text --回车
body
text
-->
<!--
html
head
meta
title
body
table
tbody
tr
th
td
text
-->