Home >Web Front-end >HTML Tutorial >When writing an HTML5 page, setting 'margin:0px,auto' in CSS cannot center the div. What is the reason? _html/css_WEB-ITnose

When writing an HTML5 page, setting 'margin:0px,auto' in CSS cannot center the div. What is the reason? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:51:591253browse

When writing an HTML5 page, setting "margin:0px,auto" in CSS cannot center the div. What is the reason?

The html page code is as follows:

<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>    <title></title>    <link href="css/login.css" rel="stylesheet" />    <script src="js/LoadJs.js" type="text/javascript"></script></head><body>       <div class="Fu">             </div>    </form></body></html>


The CSS file code is as follows:
body {    background-color:rgba(241,244,245,80);    margin:0px;    padding:0px;    text-align:center;}.Fu {   margin:0px,auto;   padding:0px;   width:400px;   height:200px;   background-color:#FFF;   border:1px solid #000;}


The div cannot be used using Firefox, IE10, or IE11. The level is centered, what is the cause and how can it be solved?


Reply to discussion (solution)

margin:0px auto;
Space

margin:0px auto;
Space



Kneel down! It’s true! I haven’t noticed it after looking at it for a long time! Points for the knot!
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn