css制作印章

使用CSS制作印章
使用CSS可以创建简单的印章效果,主要通过边框、圆角、文本和阴影等属性实现。以下是几种常见的印章样式实现方法:
圆形印章
<div class="stamp-circle">印章</div>
.stamp-circle {
width: 150px;
height: 150px;
border: 5px solid red;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
font-size: 24px;
font-weight: bold;
color: red;
text-shadow: 0 0 5px rgba(0,0,0,0.3);
box-shadow: 0 0 10px rgba(0,0,0,0.2);
}
方形印章
<div class="stamp-square">专用章</div>
.stamp-square {
width: 120px;
height: 120px;
border: 4px solid red;
display: flex;
justify-content: center;
align-items: center;
font-size: 20px;
font-weight: bold;
color: red;
transform: rotate(15deg);
box-shadow: 0 0 8px rgba(0,0,0,0.2);
}
带有边框文字的印章
<div class="stamp-text-border">
<div class="inner-text">公司印章</div>
<div class="border-text">有限公司</div>
</div>
.stamp-text-border {
width: 160px;
height: 160px;
border: 3px solid red;
border-radius: 50%;
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.inner-text {
font-size: 22px;
font-weight: bold;
color: red;
}
.border-text {
position: absolute;
top: 20px;
left: 0;
right: 0;
text-align: center;
font-size: 16px;
color: red;
transform: rotate(0deg);
}
做旧效果印章
<div class="stamp-aged">批准</div>
.stamp-aged {
width: 100px;
height: 100px;
border: 3px dashed rgba(200, 0, 0, 0.7);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
font-size: 20px;
font-weight: bold;
color: rgba(200, 0, 0, 0.7);
background-color: rgba(255, 255, 255, 0.8);
box-shadow: 0 0 10px rgba(0,0,0,0.1);
opacity: 0.9;
}
实现技巧
- 使用
border-radius: 50%创建圆形印章 - 通过
transform: rotate()实现印章倾斜效果 - 使用半透明颜色(rgba)制作老旧印章效果
- 添加
text-shadow和box-shadow增强立体感 - 结合伪元素(::before, ::after)添加装饰性元素
这些CSS方法可以组合使用,根据实际需求调整尺寸、颜色和样式,创建各种风格的印章效果。







