```html
body {
fontfamily: Arial, sansserif;
backgroundcolor: f0f0f0;
padding: 20px;
}
.container {
maxwidth: 600px;
margin: 0 auto;
backgroundcolor: fff;
padding: 20px;
borderradius: 8px;
boxshadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
textalign: center;
color: 333;
}
p {
lineheight: 1.6;
color: 666;
}
code {
backgroundcolor: f9f9f9;
padding: 2px 6px;
borderradius: 4px;
fontfamily: Consolas, monospace;
}
可爱编程代码示例
以下是一个简单的HTML和CSS代码示例,创建一个可爱的小熊表情:
<!DOCTYPE html><html lang="en">
<head>
<meta charset="UTF8">
<meta name="viewport" content="width=devicewidth, initialscale=1.0">
<title>可爱小熊表情</title>
<style>
/* 熊身体 */
.bear {
width: 150px;
height: 200px;
backgroundcolor: f7b2b2;
borderradius: 50% 50% 60% 60%;
position: relative;
}
/* 熊耳朵 */
.ear {
width: 50px;
height: 100px;
backgroundcolor: f7b2b2;
borderradius: 50%;
position: absolute;
top: 40px;
}
.ear.left {
left: 30px;
transform: rotate(40deg);
}
.ear.right {
right: 30px;
transform: rotate(40deg);
}
/* 熊眼睛 */
.eye {
width: 30px;
height: 30px;
backgroundcolor: 333;
borderradius: 50%;
position: absolute;
top: 60px;
}
.eye.left {
left: 40px;
}
.eye.right {
right: 40px;
}
/* 眼珠 */
.pupil {
width: 10px;
height: 10px;
backgroundcolor: fff;
borderradius: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(50%, 50%);
}
/* 熊鼻子 */
.nose {
width: 20px;
height: 20px;
backgroundcolor: 543847;
borderradius: 50%;
position: absolute;
top: 100px;
left: 50%;
transform: translateX(50%);
}
/* 熊嘴巴 */
.mouth {
width: 60px;
height: 20px;
border: 3px solid 000;
bordertop: none;
borderradius: 0 0 60% 60%;
position: absolute;
top: 120px;
left: 50%;
transform: translateX(50%);
}
</style>
</head>
<body>
<div class="bear">
<div class="ear left"></div>
<div class="ear right"></div>
<div class="eye left">
<div class="pupil"></div>
</div>
<div class="eye right">
<div class="pupil"></div>
</div>
<div class="nose"></div>
<div class="mouth"></div>
</div>
</body>
</html>
这段代码创建了一个简单的可爱小熊表情,使用HTML和CSS进行绘制。你可以通过修改CSS属性来改变熊的样式,尝试创造出更多有趣的表情。