gpt4 book ai didi

html - 无法在 css 中设置图像样式

转载 作者:太空宇宙 更新时间:2023-11-03 23:27:18 24 4
gpt4 key购买 nike

我正在尝试更改 div“文本”下图像的边距,但它没有检测到任何样式。我不知道我做错了什么。请指教。

这是HTML

 <div class="text">
<h2> <img src="/static/meddy1/images/ad.png" alt ="Ads"><a href="/docprofile/{{doc.id}}/">{{doc.name}}</a></h2>
<h3 id="gray" style="margin-top: -10px;"> {{doc.clinic.address_normal}}</h3>
</div>

这是CSS

.text {
margin-top: 0px;
border: 1px solid;
border-color: #C0C0C0;
height: 150px;
margin-left: 10px;
text-indent: 10px;
}

.text > img {
margin-top: 2px;
}

最佳答案

.text > img 正在寻找一级子级,但您的图像是二级级子级。

尝试 .text > h2 > img.text img - 请注意,如果您的 .text< 中有其他图像,第二个可能会导致问题 元素。

关于html - 无法在 css 中设置图像样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26483120/

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