gpt4 book ai didi

html - 我已经在我的 html 上设置了背景,现在如何将一个 id 的背景设置为不同的颜色?

转载 作者:太空宇宙 更新时间:2023-11-03 22:38:30 25 4
gpt4 key购买 nike

我是 HTML 和 CSS 的新手,我一直在努力弄清楚我整晚做错了什么。

我想将 id="transparentBox"的 div 的背景颜色设置为不同的颜色(最终是一个带有一些当前未知的不透明度设置的灰白色框)但是,看起来因为认为我通过 CSS 应用的样式没有起到作用。如有任何建议,我们将不胜感激。

我已经在我的 HTML 上设置了背景,现在如何将一个 id 的背景设置为不同的颜色?

    html
{
text-align: center;
background: linear-gradient(to top right, #33ccff 0%, #0066ff 100%) fixed;
}

body
{
text-align: center;
}

p
{
text-align: left;
}

.off
{
color: #F0FFFF;
}

#header
{
height:100px;
width:960px;
}

#header h1
{
position: relative;
text-align: left;
color: #000000;
font-size: 45px;
left: 5px;
top: 20px;
}

body
{
margin: 0px;
padding: 0px;
text-align: left;
font: 12px Arial, Helvetica, sans-serif;
font-size: 14px;
}

#navigationBar
{
height: 40px;
background-color: #F0FFFF;
border-color: #000000;
}

ul
{
list-style-type: none;
margin: 0px;
padding: 0px;
overflow: hidden;
background-color: #333;
}

li
{
float: left;
}

li a {
display: block;
color: white;
text-align: center;
padding-top: 13px;
padding-bottom: 13px;
padding-left: 15px;
padding-right: 15px;
text-decoration: none;
}

/* Change the link color to #111 (black) on hover */
li a:hover
{
background-color: #111;
}

.active
{
background-color: #4CAF50;
}

#navigationMenu
{
margin-top: 0px;
height: auto;
background-color: #F0FFFF;
border-color: #000000;
border-radius: 25px;
}

#transparentBox
{
position: relative;
display: block;
margin: 10px;
padding: 10px;
width: 500px;
height: 400px;
background-color: #FFFFFF;
border-color: #000000;
border-radius: 10px;
}
<!DOCTYPE html>
<html xmlns="http://www.calebwolff.us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="30" />
<link rel="stylesheet" type="text/css" href="style.css" />

<title>Caleb Wolff's Personal Website</title>
</head>
<body>
<div id="header">
<h1>Caleb<span class="off">Wolff</span></h1>
</div>
<div id="navigationBar">
<ul>
<li><a href="http://www.calebwolff.us">Home</a></li>
<li><a href="https://www.facebook.com/calebwolffmusic/">Facebook</a></li>
</ul>
</div>
<div id="transparnetBox">
<h1>HELLLOOO</h1>
</div>
</body>
</html>

最佳答案

改变背景有两种方法

  1. 正常改变颜色,没有阴影

    html
    {
    文本对齐:居中;
    背景:线性渐变(右上角,#33ccff 70%,#0066ff 100%)已修复;
    }

  2. 使用渐变色改变颜色您应该使用 6 位颜色代码更改 html 样式中的颜色
    html
    {
    文本对齐:居中;
    背景:线性渐变(右上角,#33ccff 70%,#0066ff 100%)已修复;
    有可用的颜色代码列表,这些颜色的不透明度以百分比设置。您可以尝试这两种方法中的任何一种。

关于html - 我已经在我的 html 上设置了背景,现在如何将一个 id 的背景设置为不同的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45125752/

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