一个带评论区边框的div
时间: 2024-03-23 21:44:05 浏览: 15
以下是一个带评论区边框的div的HTML和CSS代码示例:
```html
<!DOCTYPE html>
<html>
<head>
<title>带评论区边框的div</title>
<style>
.comment-box {
border: 1px solid #ccc;
padding: 10px;
}
.comment-box h2 {
margin-top: 0;
margin-bottom: 10px;
}
.comment-box form label {
display: inline-block;
width: 70px;
}
.comment-box form input[type="text"],
.comment-box form textarea {
width: 100%;
padding: 5px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 3px;
box-sizing: border-box;
}
.comment-box form textarea {
height: 100px;
}
.comment-box form input[type="submit"] {
background-color: #007bff;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 3px;
cursor: pointer;
}
.comment-box form input[type="submit"]:hover {
background-color: #0069d9;
}
.comment-box hr {
margin-top: 20px;
margin-bottom: 20px;
border: 0;
border-top: 1px solid #ccc;
}
.comment-box ul {
margin: 0;
padding: 0;
list-style: none;
}
.comment-box ul li {
margin-bottom: 10px;
}
.comment-box ul li strong {
font-weight: bold;
}
</style>
</head>
<body>
<div class="comment-box">
<h2>评论区</h2>
<form>
<label>昵称:</label>
<input type="text" name="nickname"><br>
<label>评论内容:</label>
<textarea name="comment"></textarea><br>
<input type="submit" value="提交评论">
</form>
<hr>
<h3>评论列表</h3>
<ul>
<li><strong>小明:</strong>这篇文章写得真好!</li>
<li><strong>小红:</strong>我觉得还有待改进。</li>
<li><strong>小刚:</strong>我不太懂这个话题。</li>
</ul>
</div>
</body>
</html>
```
这段代码将会生成一个带评论区边框的div,包含一个评论输入框和一个评论列表。你可以根据自己的需求修改这段代码,添加更多的功能和样式。