gpt4 book ai didi

html - 设置多种背景颜色为H1

转载 作者:太空宇宙 更新时间:2023-11-04 15:46:32 25 4
gpt4 key购买 nike

我在 SO 上搜索了很多类似的问题,但没有得到我想要的结果。我想要类似这样的:

screenshot

我想用不同的 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>

请查看fiddle

第二行 CSS 不工作。

see screenshot

最佳答案

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>

关于html - 设置多种背景颜色为H1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55214407/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com