<script> alert('用户名不能为空');</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body><div style="margin:0 auto;height:200px; background:#996600;"></div></body>
</html>
页面中的div无法居中显示?margin:0 auto;这句样式失效。如何解决?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body><div style="margin:0 auto;height:200px; background:#996600;"></div></body>
</html>
页面中的div无法居中显示?margin:0 auto;这句样式失效。如何解决?
alinn:center也无效的。
你的div木有内容,高度木有设置,浏览器默认高度为0,所以木有效果
js最好是单独写文件,或是写在html代码内,不要放在html代码外给分
去掉<script> alert('用户名不能为空'); </script>这句代码,就可以居中了。但是这句代码是控件自动产生的,能否用样式解决掉??