2015-05-05 157 views
0

HTML如何影响一个div的内容

<span class = "Box"> 
<div class = "active"> 
<a href ="#-night"> 
<span class ="list">4</span> 
<span class="locations"><?php echo $location; ?></span> 
<span class="type">Night </span> 
</a>   
</div> 
</span> 

CSS

.Box { 
white-space: nowrap; 
padding: 0px 20px; 
font-size: 110%; 
color: blue;} 

.list { 
height: 30px; 
width: 30px; 
line-height: 30px; 
-moz-border-radius: 15px; /* or 50% */ 
border-radius: 15px; /* or 50% */ 
text-align: center; 
display: inline-block; 
background-color: orange; 
color: blue;} 

.locations{ 
text-transform: uppercase; 
color: blue;} 

.type { 
text-transform: uppercase; 
color: blue;} 

我想要的。主动跨度改变.LIST,.locations字体颜色和.TYPE深蓝色或任何其他颜色
我不是CSS的专家,在网上寻找并没有给我任何答案。 道歉,如果我发布这个错误或要求愚蠢的问题。

+0

你的代码中的div在哪里? – Saty

+0

对不起,我还没有它,但正在考虑如果有任何区别,将跨度“活动”更改为div“活动” –

+0

编辑问题并移除php标记。之前它被拒绝 – Aviz

回答

1
.active .list, 
.active .locations, 
.active .type { 
    color: darkBlue; 
} 

例...

.Box { 
 
white-space: nowrap; 
 
padding: 0px 20px; 
 
font-size: 110%; 
 
color: blue;} 
 

 
.list { 
 
height: 30px; 
 
width: 30px; 
 
line-height: 30px; 
 
-moz-border-radius: 15px; /* or 50% */ 
 
border-radius: 15px; /* or 50% */ 
 
text-align: center; 
 
display: inline-block; 
 
background-color: orange; 
 
color: blue;} 
 

 
.locations{ 
 
text-transform: uppercase; 
 
color: blue;} 
 

 
.type { 
 
text-transform: uppercase; 
 
color: blue;} 
 

 
.active .list, 
 
.active .locations, 
 
.active .type { 
 
    color: darkBlue; 
 
}
<span class = "Box"> 
 
<div class = "active"> 
 
<a href ="#-night"> 
 
<span class ="list">4</span> 
 
<span class="locations"><?php echo $location; ?></span> 
 
<span class="type">Night </span> 
 
</a>   
 
</div> 
 
</span>

+0

这是太容易了哈哈,不知道我怎么没有想到这一点。谢谢 –

0

添加此 - :

a { 
    color :red; // your color here 
    } 

并从其他选择属性颜色。