皇家红毯
晨曦的云彩
body {
background-color: #87CEEB; /* 天蓝色 */
background-image: url('cloud.png'); /* 贴图 */
}
div {
background-repeat: no-repeat; /* 不要重复,独一无二 */
background-position: center; /* 居中放置,尊贵显赫 */
background-size: cover; /* 充满视野 */
}
background: #fff url("img.png") no-repeat right top;
任务: 给国王的披风涂上颜色。
目标:把 div 的背景颜色设为 gold (金色),并让背景图片 no-repeat (不重复)。
大卫要为城堡的大门做一个金色的按钮。请跟着步骤,一步步打造它!
先给它一个形状和底色。
.glory-btn {
padding: 15px 30px;
border: none;
border-radius: 50px; /* 圆角 */
background-color: #ffd700; /* 金色 */
color: #5c3a00; /* 深褐色文字 */
font-weight: bold;
font-size: 1.2rem;
cursor: pointer;
}
使用 linear-gradient 让它闪闪发光!
.glory-btn {
/* 从上到下的渐变:浅金 -> 深金 */
background-image: linear-gradient(to bottom, #fff2cc, #ffd700);
/* 给文字加一点阴影,更有立体感 */
text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}