CSS Notes_html/css_WEB-ITnose
Margin is on the outside of block elements while padding is on the inside. Use margin to separate the block from things outside it. Use padding to move the contents away from the edges of the block. Enter image description here:
When elements needs space between them, better to use margins. When text or an inner element needs space between the parent box and itself go for paddings.
Width & Height
When you set the width and height properties of an element with CSS, you just set the width and height of the content area. To calculate the full size of an element, you must also add the padding, borders and margins.
/* It will only have effect on the link in this page */
#this-page a:hover {
...
}
nth-child
You can actually select any child of an element after the first child with the pseudo-class selector nth-child; you just add the child's number in parentheses after the pseudo-class selector. For example,
p:nth-child(2) {
color: red;
}
would turn every paragraph that is the second child of its parent element red. The element that is the child goes before :nth-child; its parent element is the element that contains it.
下一篇: 文件过滤 看 java 回调
推荐阅读
-
php下载css中图片代码
-
HTML data属性_html/css_WEB-ITnose
-
一个简单的动态加载js和css的jquery代码_jquery
-
开坑,写点Polymer 1.1 教程第6篇--样式(2)_html/css_WEB-ITnose
-
简洁的在线按钮css生成器_html/css_WEB-ITnose
-
CSS vertical-align属性的用法_html/css_WEB-ITnose
-
图片中英文导航在IE6里面都链接不过去_html/css_WEB-ITnose
-
css用背景图来替换文字来达到隐藏文字的目的
-
在页面中引用css有几种方式?
-
在2015年 开发一个 Web App 必须了解的那些事_html/css_WEB-ITnose