猿友們再寫頁面的時候,* * 客戶可能要求相容IE8以下版本,可是你用了幾個H5的新标簽,在IE8以下完全不識别怎麼辦呢。這時,不要慌不要忙,跟我一起念:如意如意随我心意快快顯靈快快顯靈 ,哈哈哈
教大家個簡單的方法直接通過JS建立相同名字的标簽就可以了。
下面直接撸代碼:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script>
document.createElement("header");
document.createElement("section");
document.createElement("footer");
</script>
<style>
header{
width: px;
height: px;
display: block;
background-color: red;
}
section{
width: px;
height: px;
display: block;background-color: yellow;
}
footer{
width: px;
height: px;
display: block;
background-color: blue;
}
</style>
</head>
<body>
<header>header</header>
<section>section</section>
<footer>footer</footer>
</body>
</html>
style樣式中需要display:block;是因為JS中建立的标簽是内聯的。
初學者,小知識,歡迎反駁!