如何解决html5语义化兼容问题,这里为何main.style.display为空
<!DOCTYPE html><html>
<head>
<meta charset="utf-8" />
<title>旅游</title>
<script>
document.createElement('article');
document.createElement('nav');
document.createElement('header');
document.createElement('footer');
document.createElement('main');
</script>
<style>
article,main,header,nav,footer{
display:block;
}
</style>
<link href='css/css首页.css' rel="stylesheet">
</head>
<body>
<!-- <main></main> -->
<div>1</div>
<script>
var body=document.querySelector('body');
varmain=document.createElement('main');
body.appendChild(main);
console.log(main.style.display);///问题所在/////////////////////////
console.log(main);
</script>
</body>
</html>
没有设置style当然是空的
页:
[1]