gpt4 book ai didi

css - 标签 "div.img img"是什么意思?

转载 作者:技术小花猫 更新时间:2023-10-29 11:25:14 25 4
gpt4 key购买 nike

我理解创建类标签的一般概念,例如 .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>

最佳答案

到目前为止给出的所有答案都是正确的,但也许也解释一下它不是什么会有所帮助。

同时 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>

关于css - 标签 "div.img img"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6405889/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com