It seems that you want the following html:
(看来您想要以下html:)
<div class="read-window-links">
<span class="read-window window">
<p>${properties.readText}</p>
</span>
<span class="read-window less hidden">
<p>${properties.readLessLinkText}</p>
</span>
</div>
I've removed the a
tags and added the a
classes to the child span
tags.
(我删除了a
标签,并将a
类添加到了子span
标签中。)
Your css will no longer work because you are matching based on DOM hierarchy, not just class name.
(您的css将不再起作用,因为您是基于DOM层次结构而不只是基于类名进行匹配。)
See this article for a more in-depth treatment, but essentially in eg this section: (有关更深入的处理,请参见本文 ,但实际上在本节中:)
.read-window-section .read-window-links .window .read-window p:after {
content: url(down_arrow_icon.png);
display: inline-block;
}
you are saying, "set content
to url(down_arrow_icon.png)
and display
to inline-block
for a p
which is a descendant of an element with class read-window
which is a descendant of an element with class window
which is a descendant of an element with class read-window-links
..." etc. If you change the DOM hierarchy, you need to change your css to match, which means something like
(你说的是,“将content
设置为url(down_arrow_icon.png)
并display
为行inline-block
,而p
是具有类read-window
的元素的后代,它是具有class window
的元素的后代,而window
是该元素的后代具有类read-window-links
...“的元素。如果更改DOM层次结构,则需要更改css以匹配,这意味着类似)
<span class="read-window window">
<p>${properties.readText}</p>
</span>
.read-window-section .read-window-links .window.read-window p:after {
content: url(down_arrow_icon.png);
display: inline-block;
}
Notice how there is no space between .window
and .read-window
, which means "match an element with both .window
and .read-window
classes."
(请注意, .window
和.read-window
之间没有空格,这意味着“将元素与.window
和.read-window
类都匹配”。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…