制作评论留言‘css’
创建评论留言框的CSS样式
基础样式框架:

.comment-box {
width: 100%;
max-width: 600px;
margin: 20px auto;
padding: 15px;
border: 1px solid #e0e0e0;
border-radius: 8px;
background-color: #f9f9f9;
}
输入区域样式
.comment-input {
width: 100%;
min-height: 100px;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;
resize: vertical;
font-family: inherit;
font-size: 14px;
margin-bottom: 10px;
}
按钮样式设计
.submit-btn {
background-color: #4285f4;
color: white;
border: none;
padding: 8px 16px;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s;
}
.submit-btn:hover {
background-color: #3367d6;
}
已发布评论样式
.comment-list {
margin-top: 30px;
}
.comment-item {
background-color: white;
border: 1px solid #eee;
border-radius: 6px;
padding: 12px 15px;
margin-bottom: 15px;
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.comment-author {
font-weight: bold;
color: #333;
margin-bottom: 5px;
}
.comment-content {
color: #555;
line-height: 1.5;
}
.comment-time {
font-size: 12px;
color: #999;
margin-top: 5px;
}
响应式设计调整
@media (max-width: 640px) {
.comment-box {
padding: 10px;
}
.comment-input {
min-height: 80px;
}
}
动画效果增强
.comment-item {
transition: transform 0.2s, box-shadow 0.2s;
}
.comment-item:hover {
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}






