html应用样式div.s1与 .s1区别
本文介绍了html应用样式div.s1与 .s1区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
html应用样式div.s1与 .s1区别
<head>
<meta http-equiv="Content-Type" content="text/html"; charset="UTF-8">
<style>
div.s1 { text-align: center;
width: auto;
height: auto;
margin: 3px'
}
</style>
</head>
<body>
<div class="s1">
<img src="1.jpg" alt="Ballade" width=160px height="160px">
</div>
</body>
<head>
<meta http-equiv="Content-Type" content="text/html"; charset="UTF-8">
<style>
.s1 { text-align: center;
width: auto;
height: auto;
margin: 3px'
}
</style>
</head>
<body>
<div class="s1">
<img src="1.jpg" alt="Ballade" width=160px height="160px">
</div>
</body>
解决方案
div.s1
取的是所有class
为s1
的div
元素,.s1
取的是所有class
为s1
的元素,二者差别就在于是否限定元素为div
这篇关于html应用样式div.s1与 .s1区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文