简体   繁体   English

组合div和span标记样式失败

[英]Combining div and span tag styles failing

There are two types of help text container I have. 我有两种类型的帮助文本容器。 One is in <div> other is in <span> I wrote a css both in one style. 一个在<div>另一个在<span>我用一种样式编写了一个CSS。 It's working good but those <div> and <spans> includes an arrow styled child <div> and <span> . 它运行良好,但是<div><spans>包含一个箭头样式的元素<div><span> I tried to combine that .arrow styles but it failed in practice. 我尝试结合使用.arrow样式,但是在实践中失败了。 Is there a way combine those same styles? 有没有办法结合这些相同的样式?

HTML example for <div> : <div> HTML示例:

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

HTML example for <span> : <span> HTML示例:

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

CSS for both: 两者的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;
}

CSS .arrow example for <div> : <div> CSS .arrow示例:

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

CSS .arrow example for <span> : <span> CSS .arrow示例:

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

I can't combine last two css. 我不能结合最后两个CSS。

You are missing .arrow in both selectors for your css 您在CSS的两个选择器中都缺少.arrow

Use this 用这个

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;
}

I think you can .helptext .arrow as selector, if you don't have another element with classname helptext . 我认为如果没有其他具有classname helptext元素,则可以将.helptext .arrow用作选择器。

You should use below code: 您应该使用以下代码:

.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.

相关问题 消除<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 获取 div/span 标签的位置 - Get the position of a div/span tag div标签内的跨度标签未出现 - Span tag inside the div tag is not appearing 无法加载Img标签(子级)的Span标签(父级)中的Bootstrap工具提示 - Bootstrap Tooltip in Span Tag (parent) of Img tag (child) failing to load 从 span 标签实现 styles 现在它的内容在一个数组中 - Implement styles from a span tag now that it's contents are in an array 如何在内部<span>或</span>内部转义 HTML<div> <span>标签</span> - How to escape HTML inside <span> or <div> tag 更改div的宽度以匹配span标签的宽度 - changing width of div to match width of span tag 如何显示一个<span>或</span><div><span>将内容标记为星号(*)</span> - How to show a <span> or <div> tag content as asterisk(*) 排除div中第一个span标签的子元素 - Exclude children of the first span tag inside div 将span元素右移到div标签 - move span element right to div tag
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM