HTML 中<style>中</style>里面这个这个标签是干嘛的<!-- -->

如题所述

没什么用,这个主要是针对低版本的浏览器
<!-- -->是html的注释标签,高版本的浏览器会识别<style>标签是样式表,并忽略里面的html注释标签,会解析它,低版本的浏览器有的不识别<style>标签,就会把样式表的内容显示在页面上,所以加上注释标签,这样就算低版本的浏览器不识别<style>标签,也不会把里面的内容显示在页面上。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2018-03-29

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
#header {
background-color: black;
color: white;
text-align: center;
padding: 5px;
}
#nav{
line-height: 30px;
background-color: #eeeeee;
height: 300px;
width: 100px;
float: left;
padding: 5px;
}
#section{
width: 350px;
float: left;
padding: 10px;
}
#footer{
background-color: black;
color: white;
clear: both;
text-align: center;
padding: 5px;
}
</style>
</head>

<body>

<div id="header">
<h1>City gallery</h1>
</div>

<div id="nav">
London<br>
Paris<br>
Tokyo<br>
</div>

<div id="section">
<h2>London</h2>
<P>FHRUGHTHJYOJUJYOGRGIUHRUTHURHGURGUFHGUFGUFGHFUGFUGUGUHU</P>
<P>RTY67777777777UKIJOK99O0P087YTHYHTYHYUYUURYTUYJ7U</P>
</div>

<div id="footer">
Copyright ? W3Schools.com
</div>
</body>
</html>

第2个回答  2022-01-08
style标签里面写样式
<style>

.d{color: red;}
</style>

--------------------------
<!---->里面是注释,里面不会执行
相似回答