Home >Web Front-end >HTML Tutorial >Why after using div to add a small form, the entire page in the center will move a little to the left, and the same will happen after PHP searches the database and returns data_html/css_WEB-ITnose
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.