Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html CSS-样式颜色在使用省略号时不作为锚定标记,而是采用与主div类相同的颜色_Html_Css - Fatal编程技术网

Html CSS-样式颜色在使用省略号时不作为锚定标记,而是采用与主div类相同的颜色

Html CSS-样式颜色在使用省略号时不作为锚定标记,而是采用与主div类相同的颜色,html,css,Html,Css,注意:CSS颜色在使用省略号时不作为锚标记,但 采用与主div类相同的颜色 CSS: <style type="text/css"> .oneline { text-overflow : ellipsis; white-space : nowrap; width : 50px; overflow : hidden; color: #f00; } a

注意:CSS颜色在使用省略号时不作为锚标记,但 采用与主div类相同的颜色

CSS:

<style type="text/css">
    .oneline {
        text-overflow : ellipsis;
        white-space   : nowrap;
        width         : 50px;
        overflow      : hidden;
        color: #f00;
     }
    a {color:#000;}
</style>
<div class="oneline">

    Testing 123 Testing 456 Testing 789 <br/>
    <a href="">Testing 123 Testing 456 Testing 789</a>
</div>

.一行{
文本溢出:省略号;
空白:nowrap;
宽度:50px;
溢出:隐藏;
颜色:#f00;
}
a{color:#000;}
测试123测试456测试789
试试:


尝试在文本周围添加额外的元素。因为已经将它赋予父元素,所以它将省略号颜色视为PARTNT元素文本颜色。

HTML

<div class="oneline">    
    <span>Testing 123 Testing 456 Testing 789</span> <br/>
    <a href="">Testing 123 Testing 456 Testing 789</a>
</div>

您已经为所有带有“a”标记的元素设置了黑色


若要为特定元素“a”标记指定特定颜色,请将classname与“a”标记一起使用,并指定所需的颜色。

在不提供重要信息的情况下,我添加了颜色:-)是的,不需要重要信息。我在尝试使用你的html时使用的,然后我忘了删除它
<div class="oneline">    
    <span>Testing 123 Testing 456 Testing 789</span> <br/>
    <a href="">Testing 123 Testing 456 Testing 789</a>
</div>
.oneline span, .oneline a {
        display:block;
        text-overflow : ellipsis;
        white-space   : nowrap;
        width         : 50px;
        overflow      : hidden;
        color:#f00;
     }  
    .oneline a {       
        color:#000
  }