css两种颜色的h1

编程入门 行业动态 更新时间:2024-10-10 17:25:32
本文介绍了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

本文发布于:2023-11-28 21:56:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1644080.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:两种   颜色   css

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!