html - 将多种背景颜色设置为 H1
问题描述
我在 SO 上搜索了许多类似的问题,但没有得到我想要的结果。我想要这样的类似:
我想用不同的 BG 颜色设计两条不同的线条
我试过这种风格
h1.g1-mega.g1-mega-1st.entry-title:first-line {background:#ffd334;}
h1.g1-mega.g1-mega-1st.entry-title:last-line {background:#ddd;}
<h1 class="g1-mega g1-mega-1st entry-title" itemprop="headline">Top 25 Wild Bird Photographs of the Week: Mountain Birds </h1>
请检查小提琴
第二行 CSS 不起作用。
解决方案
span:first-child {
background-color: yellow;
padding: 10px;
}
span:last-child {
background-color: lightgreen;
padding: 10px;
}
h1 {
line-height: 1.8;
}
<h1><span>Top 25 Wild Bird Photographs</span><br>
<span>of the Week: Mountain Birds </span>
</h1>
推荐阅读
- java - 测试依赖项调用的 lambda 表达式
- selenium - 获取 XHR 响应(网络流量)并在 Katalon Studio 中解析
- ios - 如何从 Swift 中的输入音频文件生成相位反转音频文件?
- python-3.x - cv2 - 用噪声掩盖图像
- c# - 两个相反的modelBuilder关系设置有什么区别?
- java - 有没有办法增加netty中的DNS缓存TTL?
- android - 找不到方法 maven() 的解决方案
- r - 过滤行最大值大于阈值的行
- c++ - 如何支持 any_cast 将自定义类转换为字符串?
- python - 将熊猫数据框转换为字典,其中键是索引,值是列值列表