---
title: "CSS学习（未完）"
author: "dtxbcsy"
date: "2011-04-16T12:56:26Z"
tags: []
categories: ["Web前端"]
slug: "css"
draft: false
lastmod: "2011-04-16T19:09:07Z"
id: 1004931
url: "https://dtxbcsy.iteye.com/blog/1004931"
---

1. 居中一个DIV，margin:0px auto;（这个只是水平居中，垂直居中比这个复杂，而且兼容性不佳）
2. 一个DIV，不指定folat，无论宽度，直接填充整行，多余的空间留白。（不确定理解是否正确）
3. background所作用的区域是内容和padding区域，所以有背景图片或背景色的时候两者就不同了：调整padding背景的范围会变，而调整margin则不会。  
   ![](http://dl.iteye.com/upload/attachment/464887/8f46c9cc-854a-3998-9bcd-e303db39f391.gif)
4. 未完

<!--THE END-->