核心提示:猿友们再写页面的时候,* * 客户可能要求兼容IE8以下版本,可是你用了几个H5的新标签,在IE8以下完全不识别怎么办呢。这时,不要慌不要忙,跟我一起念:如意如意随我心意快快显灵快快显灵 ,哈哈哈教大...
猿友们再写页面的时候,* * 客户可能要求兼容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: 200px; height: 200px; display: block; background-color: red; } section{ width: 150px; height: 150px; display: block;background-color: yellow; } footer{ width: 100px; height: 100px; display: block; background-color: blue; } </style> </head> <body> <header>header</header> <section>section</section> <footer>footer</footer> </body> </html>
style样式中需要display:block;是因为JS中创建的标签是内联的。
初学者,小知识,欢迎反驳!