文章详情页
设置了margin:0 auto;无法居中咋回事?
问题描述
<!DOCTYPE html>
<html>
<head>
<meta charset ="UTF-8">
<title>1.单列等宽布局</title>
<!--样式-->
<style type="text/css">
.container{
max-width: 960px;<!--设置最大宽度为960px-->
margin:0 auto;<!--设置内部的块元素水平居中-->
}
.header{
height:50px;
background-color:#21ff80;
}
.main{
height:600px;
background-color:#80007f;
}
.footer{
height:100px;
background-color:#21ff80;
}
</style>
</head>
<body>
<h4>单列等宽布局基本思路:</h4>
<p>1.页面的头部,主体和底部全部放在一个容器中统一设置<br>
2.容器中的子块只需要设置一下高度即可
</p>
<div>
<div>头部</div>
<div>主体</div>
<div>底部</div>
</div>
</body>
</html>
问题解答
回答1:好了解决了,注释出了问题,用的Notepad++写的,直接用快捷键注释,没注意看。
回答2:你只写了样式,但是并没有使用样式
上一条:.......下一条:您好师太我想请教这个框架怎么搭建呢?
相关文章:
1. python相关问题求解决,有偿2. javascript - input输入框触发change事件后,外部元素会被选中3. python - 用__call__ 实现装饰器功能4. javascript - 把字符串日期转换成一般时间格式后,发现小于10的数字不会自动添加0在前面,如下5. javascript - 在sublime中如何给.vue文件注释?6. javascript - js判断一个数组是否重复7. python - 请问用cxfreeze打包的可执行程序能反编译出源码么?8. javascript - vue2.0中router.repalce跟router.push有什么区别,二者的应用场景是会有怎样的区别?9. javascript - 这种上传图片预览怎么做?10. javascript - prismplayer播放器全屏问题
排行榜