html礼物盒子代码
时间: 2023-11-14 20:55:52 浏览: 72
以下是一个简单的 HTML 礼物盒子代码示例:
```html
<!DOCTYPE html>
<html>
<head>
<title>Gift Box</title>
<style>
.container {
width: 200px;
height: 200px;
background-color: red;
position: relative;
}
.ribbon {
width: 80px;
height: 30px;
background-color: gold;
position: absolute;
top: -20px;
left: 60px;
transform: rotate(-45deg);
}
.box {
width: 120px;
height: 120px;
background-color: white;
position: absolute;
top: 40px;
left: 40px;
}
</style>
</head>
<body>
<div class="container">
<div class="ribbon"></div>
<div class="box"></div>
</div>
</body>
</html>
```
这段代码使用 HTML 和 CSS 创建了一个简单的礼物盒子。在浏览器中打开这个 HTML 文件,你将看到一个红色的盒子,带有一个金色的彩带和一个白色的盒子。你可以根据需要调整样式和尺寸来适应你的要求。