PHP开发 发表评论功能教程之HTML页面
我们的HTML页面结构主要由读取评论列表<div id="comments">和
发表评论的表单<div id="post">构成
代码如下
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>发表评论</title> </head> <body> <div class="demo"> <div id="comments"> <h3>评论列表</h3> </div> <div id="post"> <h3>发表评论</h3> <p>昵称:</p> <p><input type="text" class="input" id="user" /></p> <p>评论内容:</p> <p><textarea class="input" id="txt" style="width:100%; height:80px"></textarea></p> <p><input type="submit" value="发表" id="add" /></p> <div id="message"></div> </div> </div> </body> </html>
加上我们的css样式
用CSS控制页面外观,注意其中#message用来控制发表评论成功后的提示信息的样式。
<style type="text/css">
.demo{
width:500px;
margin: 0 auto;
}
h3{
font-size:18px
}
#comments{
margin:10px auto
}
#post{
margin-top:10px
}
#comments p,#post p{
line-height:30px
}
#comments p span{
margin:4px; color:#999
}
#message{
position:relative;
display:none;
width:100px;
padding:4px;
margin-top:-100px;
margin-left:30px;
background: #ff0000;
color: #c286ff;
z-index:1001
}
</style>

℡ ç 江
福
7年前 添加回复 0