margin:0px auto;进行这个设置时,元素必须处于文档流内。
2.元素溢出: 记住一个即可:overflow:auto;(自动在hidden和scroll之间切换,visible为默认。)
3.定位:
3.1 static:默认,元素处于正常文档流中; 3.2 position:relative:相对定位
demo:box>box1+box2+box3
3.2.1 box1: position:relative; left:100px; ====>box1相对于box向右移100px
3.2.2 box2:position:relative; right:100px; ====>box2相对于box向左移100px
3.3 position:absolute: 绝对定位
demo:box>box1+box2+box3
3.3.1 box1: position:absolute; left:100px; ====>box1相对于body的左边缘距离为100px
3.3.2 box2:position:absolute; right:100px; ====>box2相对于body的右边缘距离为100px
3.3.3 在3.3.1的前提下给box设置 position:relative;box1相对于box的左边缘的距离为100px
3.3.4 在3.3.2的前提下给box设置 position:relative;box2相对于box的右边缘的距离为100px
怎么解决? demo: label {width: 50px; float: left; margin-left: 15px; margin-top: 15px; }5. 5.1 text-align 设置文字水平对齐方式,如text-align:center 设置文字水平居中 5.2 text-indent 设置文字首行缩进,如:text-indent:32px; 设置文字首行缩进32px,文字默认为16px.
6.<style> 选择器与选择器之间不能加分号,分号后面的选择器无效[切记!]
</style>