gpt4 book ai didi

html - 如何使标题以不同颜色显示

转载 作者:行者123 更新时间:2023-12-02 01:17:00 25 4
gpt4 key购买 nike

我希望我的标题“Bully-Free Zone”以不同的颜色显示。我放了五个标题,以便为每个标题分配一种颜色,这样它们看起来有点像渐变。例如,第一个标题我要显示为浅灰色,第二个标题为灰色,第三个为深灰色,第四个为灰色,第五个为浅灰色。我该如何分配不同的颜色,因为它们都是 h1 http://imgur.com/tiU0z

HTML

  <html>
<head>
<link rel="stylesheet" type="text/css" href="body.css"/>
</head>
<body>
<h1>Bully-Free Zone<br/> Bully-Free Zone <br/> Bully-Free Zone <br/>
Bully-Free Zone <br/>
Bully-Free Zone </h1>

<h2>"Online harassment lhas an off-line impact"</h2>
<!--Menu-->
<div id="nav">
<a href="mainpage.htm" class="nav-link">HOME</a>
<a href="page1.htm" class="nav-link">ASSISTANCE</a>
<a href="page2.htm" class="nav-link">CYBER-BULLYING SIGNS</a>
<a href="page3.htm" class="nav-link">REPORT</a>
</div>
<div id="content"> Your Content Here Your Content Here Your Content Here <br/>
Your Content Here Your Content Here<br/>
Your content here </div>
<img src="nobullying.jpg" id="picture"/>
<!--Copyright-->
<div id="center">
<td> Copyright © 2012 Bully-FreeZone.net</td>
</div>

</body>
</html>

CSS:

  body{/* IE10 */ 
background-image: -ms-linear-gradient(top left, #555BB5 0%, #FC5B5B 100%);

/* Mozilla Firefox */
background-image: -moz-linear-gradient(top left, #555BB5 0%, #FC5B5B 100%);

/* Opera */
background-image: -o-linear-gradient(top left, #555BB5 0%, #FC5B5B 100%, );



/* Webkit (Chrome 11+) */
background-image: -webkit-linear-gradient(top left, #555BB5 0%, #FC5B5B 100%);

/* Proposed W3C Markup */
background-image: linear-gradient(top left, #555BB5 0%, #FC5B5B 100% );
}
h1{color:black;text-align:center;font-size:40px;font-family:broadway;
}
h2{color:black; text-align:center;font-size:27px;font-style:italic;}

/*Menu Buttons Orange*/
a.nav-link:link
{
color: black;
text-decoration: underline;

}
a.nav-link:visited
{
color: black;
text-decoration: none;
}
a.nav-link:hover
{
color:black;
text-decoration: overline;
}
a.nav-link:active
{
color: black;
text-decoration: none;
}

/*Menu button styles*/
#nav{text-align:center; font-family:"Bernard MT Condensed"; font-size:30px;
}
#center{text-align:center;}
#picture{background-image: url(nobullying.jpg);
width:200px;
height:400px;
position:absolute;
left:10px;
Top:190px;
bottom:10px;
}
#content {
text-align:left;
width:550px;
margin:20 auto;
}

最佳答案

因为页面实际上不应该有多个 <h1>标签,您可以通过 <span> 在标签本身内进行区分.

您可以按如下方式设置您的 h1 标签...

<h1>
<span class="light-grey">Bully-Free Zone</span>
<span class="med-grey">Bully-Free Zone</span>
<span class="dark-grey">Bully-Free Zone</span>
<span class="med-grey">Bully-Free Zone</span>
<span class="light-grey">Bully-Free Zone</span>
</h1>

CSS:

h1 span {
display: block;
}
h1 span.light-grey {
color: lightgrey;
}
h1 span.med-grey {
color: grey;
}
h1 span.dark-grey {
color: darkgrey;
}

关于html - 如何使标题以不同颜色显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10202165/

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