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?
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>
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;}
margin:0px auto;
Space
margin:0px auto;
Space