css两种颜色的h1 [英] css two colors of h1

查看:420
本文介绍了css两种颜色的h1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个CSS代码:

h1 {
    font-size:22px;
    color:#341C12;
    font-weight:normal;
    font-style:italic;
}
.h1color h1{
    color:#862E06;
}

和此HTML代码

<h1>News <span class="h1color">&amp; events</span></h1> 

但它不工作。我想要做的是有第一个h1文本是颜色#341C12和其他文本到#862E06只使用1 h1标签..

but its not working. want i want to do is have the first h1 text to be color #341C12 and the other text to #862E06 with using only 1 h1 tag..

推荐答案

This:

.h1color h1{

应为:

h1 .h1color {

订单是父子,如果你总是只有1 span,你也可以省略类,然后执行:

The order is parent child, if you always just have 1 span, you could also leave out the class, and do:

h1 span {

这篇关于css两种颜色的h1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆