I just learned PHP and made a message board. The whole page is centered. After adding the div form, the page moves to the left.
<div style="margin-top:20px;margin-left:10px;"> <strong>发表留言</strong>( php新手,谢谢。)</div> <div id=respond style="margin-top:10px;margin-left:10px;"> <form action="posted.php" method="post" id="commentform"> <input name="name" id="author" value="" type="text" /><br /> <input name="email" id="email" value="" type="text" /><br /> <input name="qq" id="url" value="" type="text" /><br /> <textarea name="info"></textarea><br /> <button type="submit" name="submit" id="submit">提交响应</button><button type="reset">重置</button> </form> </div>
form{margin:0; padding:0}
form{margin:0; padding:0} After trying it, it still moved to the left as a whole
I found the reason. When the page exceeds the vertical length of the browser, it moves to the left. What should I do?
Because a scroll bar appears, just set: overflow-y:scroll in the body.
The method above solves this problem. You really need to learn basic css well.