繁体   English   中英

组合div和span标记样式失败

[英]Combining div and span tag styles failing

我有两种类型的帮助文本容器。 一个在<div>另一个在<span>我用一种样式编写了一个CSS。 它运行良好,但是<div><spans>包含一个箭头样式的元素<div><span> 我尝试结合使用.arrow样式,但是在实践中失败了。 有没有办法结合这些相同的样式?

<div> HTML示例:

<div class="helptext" id="{{ id_for_label }}">
    <div class="arrow"></div> Helptext is in here
</div>

<span> HTML示例:

<span class="helptext" id="{{ id_for_label }}">
    <span class="arrow"></span> Helptext is in here
</span>

两者的CSS:

div[class="helptext"],span[class="helptext"] {
    position: absolute;
    display: none;
    right: 15px;
    margin-top: 3px;
    padding: 10px;
    border: 1px solid #3c578c;
    background-color: #FCFCF0;
    opacity: 0.9;
    color: red;
    border-radius: 5px;
    box-shadow: 5px 5px 15px 1px dimgray;
    text-align: justify;
    font-size: 12px;
    z-index:100000;
}

<div> CSS .arrow示例:

div[class="helptext"] .arrow {display: block; position: absolute; border: 10px solid transparent;
                                  border-bottom-color: #3c578c; top: -20px; right: 10px;}

<span> CSS .arrow示例:

span[class="helptext"] .arrow {display: block; position: absolute; border: 10px solid transparent;
                                   border-bottom-color: #3c578c; top: -20px; right: 10px;}

我不能结合最后两个CSS。

您在CSS的两个选择器中都缺少.arrow

用这个

div[class="helptext"] .arrow,span[class="helptext"] .arrow{
    position: absolute;
    display: none;
    right: 15px;
    margin-top: 3px;
    padding: 10px;
    border: 1px solid #3c578c;
    background-color: #FCFCF0;
    opacity: 0.9;
    color: red;
    border-radius: 5px;
    box-shadow: 5px 5px 15px 1px dimgray;
    text-align: justify;
    font-size: 12px;
    z-index:100000;
}

我认为如果没有其他具有classname helptext元素,则可以将.helptext .arrow用作选择器。

您应该使用以下代码:

.helptext {
    position: absolute;
    display: none;
    right: 15px;
    margin-top: 3px;
    padding: 10px;
    border: 1px solid #3c578c;
    background-color: #FCFCF0;
    opacity: 0.9;
    color: red;
    border-radius: 5px;
    box-shadow: 5px 5px 15px 1px dimgray;
    text-align: justify;
    font-size: 12px;
    z-index:100000;
}
.helptext .arrow { 
    display: block;
    position: absolute; 
    border: 10px solid transparent;
    border-bottom-color: #3c578c; 
    top: -20px; 
    right: 10px;
}

消除<div>并<span>标记</span></div><div id="text_translate"><p>我正在使用 CKEditor 4.19.1。 如果我在另一个网站上拖动并复制并粘贴包含 and 标签的内容,and 标签就会消失。</p><p> 按版本测试时,正常复制粘贴 4.4.8 版本,但从 4.5.X 版本开始删除标签</p><p>下面的配置不起作用。</p><pre> config.allowedContent = true; config.format_tags = 'p;h1;h2;h3;pre;div'; config.extraAllowedContent = 'div';</pre><p> 我应该怎么办?</p></div>

[英]Remove <div> and <span> tag

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM