我理解创建类标记的一般想法,例如.center或p.center,但是做"p.center p"之类的东西意味着什么?我在用css创建图库时看到了这样的例子.div.img img是什么意思?谢谢一堆!
<html>
<head>
<style type="text/css">
div.img
{
margin: 2px;
}
div.img img
{
display: inline;
margin: 3px;
border: 1px solid #ffffff;
}
div.img a:hover img {border: 1px solid #0000ff;}
</style>
</head>
<body>
<div class="img">
<a target="_blank" href="klematis4_big.htm"><img src="klematis4_small.jpg" alt="Klematis" width="110" height="90" /></a>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
Tim*_*ery 14
到目前为止给出的所有答案都是正确的,但也许也解释它不会有所帮助.
虽然div.img img { }会影响img元素中包含的<div class="img">元素,但以下是一些不会影响的元素:
<body>
<img src="klematis4_small.jpg" alt="Klematis"><br>
This image is not contained in a div, therefore it cannot possibly be
contained in a div of the class "img" and is therefore unaffected.
<div>
<img src="klematis4_small.jpg" alt="Klematis"><br>
This img element is in a div, but the div is not of the class "img",
so the img element is unaffected.
</div>
<div id="img">
<img src="klematis4_small.jpg" alt="Klematis"><br>
This img is contained within a div that has an ID of "img", but it is
also not of the class "img" and is therefore unaffected.
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22371 次 |
| 最近记录: |