gpt4 book ai didi

css - 这是一个 CSS 继承问题吗?

转载 作者:行者123 更新时间:2023-11-28 19:08:36 26 4
gpt4 key购买 nike

这是我的CSS:

    .sub-content-border {
background-image: url(/images/borders/sub-content/top.gif);
background-repeat: repeat-x;
background-position: top;
}
.sub-content-border div {
background-image: url(/images/borders/sub-content/bottom.gif);
background-repeat: repeat-x;
background-position: bottom;
}
.sub-content-border div div {
background-image: url(/images/borders/sub-content/left.gif);
background-repeat: repeat-y;
background-position: left;
}
.sub-content-border div div div {
background-image: url(/images/borders/sub-content/right.gif);
background-repeat: repeat-y;
background-position: right;
}
.sub-content-border div div div div {
background-image: url(/images/borders/sub-content/top-left.gif);
background-repeat: no-repeat;
background-position: left top;
}
.sub-content-border div div div div div {
background-image: url(/images/borders/sub-content/top-right.gif);
background-repeat: no-repeat;
background-position: right top;
}
.sub-content-border div div div div div div {
background-image: url(/images/borders/sub-content/bottom-left.gif);
background-repeat: no-repeat;
background-position: left bottom;
}
.sub-content-border div div div div div div div {
background-image: url(/images/borders/sub-content/bottom-right.gif);
background-repeat: no-repeat;
background-position: right bottom;
padding: 18px;
}
.sub-content-border div div div div div div div div {
background-image: url(/images/blank.gif);
padding: 0px;
}

这是我的 HTML:

<div class="sub-content-border"><div><div><div><div><div><div><div><div>
Test
<div class="sub-content-border"><div><div><div><div><div><div><div><div>
Test
</div></div></div></div></div></div></div></div></div>
</div></div></div></div></div></div></div></div></div>

但是,不是在框架中获取框架,而是内部框架不存在(参见图片:i47.tinypic.com/kcihcy.jpg)

有人知道为什么吗?

但是,如果我做了一个肮脏的把戏并在样式中添加 CSS,它会出现:

    <div class="sub-content-border"><div><div><div><div><div><div><div><div>
Test
<div class="sub-content-border" style="background-image: url(/images/borders/sub-content/top.gif); background-repeat: repeat-x; background-position: top;">
<div style="background-image: url(/images/borders/sub-content/bottom.gif); background-repeat: repeat-x; background-position: bottom;">
<div style="background-image: url(/images/borders/sub-content/left.gif); background-repeat: repeat-y; background-position: left;">
<div style="background-image: url(/images/borders/sub-content/right.gif); background-repeat: repeat-y; background-position: right;">
<div style="background-image: url(/images/borders/sub-content/top-left.gif); background-repeat: no-repeat; background-position: left top;">
<div style="background-image: url(/images/borders/sub-content/top-right.gif); background-repeat: no-repeat; background-position: right top;">
<div style="background-image: url(/images/borders/sub-content/bottom-left.gif); background-repeat: no-repeat; background-position: left bottom;">
<div style="background-image: url(/images/borders/sub-content/bottom-right.gif); background-repeat: no-repeat; background-position: right bottom; padding: 18px;">
<div style="background-image: url(/images/blank.gif); padding: 0px;">
Test
</div></div></div></div></div></div></div></div></div>
</div></div></div></div></div></div></div></div></div>

见图:http://i46.tinypic.com/2dh9ut2.jpg

最佳答案

使用 div > div > div

div div 将匹配另一个 div 下面的每个 div

关于css - 这是一个 CSS 继承问题吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2081671/

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