Margin vs. Padding
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.

Hover to show underline
You'll most often use this selector when applying, for example, a border-bottom to anchor tags, when hovered over.

a:hover {
border-bottom: 1px solid black;
}

Pro-tip - border-bottom: 1px solid black; looks better than text-decoration: underline;.

CSS Notes的更多相关文章

  1. CSS编写指导规范和建议

    在参与规模庞大.历时漫长且参与人数众多的项目时,所有开发者遵守如下规则极为重要: 保持 CSS 易于维护 保持代码清晰易懂 保持 CSS 的可拓展性 为了实现这一目标,我们要采用诸多方法. 本文档第一 ...

  2. 各式 Web 前端開發工具整理

    程式碼編寫工具 (Coding Tools) 工作流程/建置/組合 (Workflow/Builds/Assemblers) lumbar brunch grunt lineman yeoman Ta ...

  3. sequelize 学习之路

    如果你觉得Sequelize的文档有点多.杂,不方便看,可以看看这篇. 在使用NodeJS来关系型操作数据库时,为了方便,通常都会选择一个合适的ORM(Object Relationship Mode ...

  4. Sequelize 和 MySQL 对照Sequelize 和 MySQL 对照

    安装 这篇文章主要使用MySQL.Sequelize.co来进行介绍.安装非常简单: $ npm install --save co $ npm install --save sequelize $ ...

  5. Matplotlib数据可视化(3):文本与轴

      在一幅图表中,文本.坐标轴和图像的是信息传递的核心,对着三者的设置是作图这最为关心的内容,在上一篇博客中虽然列举了一些设置方法,但没有进行深入介绍,本文以围绕如何对文本和坐标轴进行设置展开(对图像 ...

  6. Notes of Head.First.HTML.and.CSS.2nd.Edition

    What does the web server do? tirelessly waiting for requests from webbrowsers What does the web brow ...

  7. Learning Notes for HTML/CSS/JS

    @1:内部样式表 & 外部样式表 内部样式表的定义,放在<style></style>中,<style>标签放在<head>中 <html ...

  8. CSS字体记录

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaYAAACnCAIAAADVOG9FAAAgAElEQVR4nOy9eXwcxZk/vL/9ve8eb7 ...

  9. 开始编写CSS

    本文由大漠根据Krasimir Tsonev的<Starting to Write CSS>所译,整个译文带有我们自己的理解与思想,如果译得不好或不对之处还请同行朋友指点.如需转载此译文, ...

随机推荐

  1. Android App开发技能图谱(转载)

    操作系统 Windows/MacOSX/Linux 编程语言 Java HTML/JS (Hybrid/Web App) C/C++ (NDK) SQL (DB) Kotlin 开发工具 IDE An ...

  2. 如何改变git的默认路径

    1.win10下git默认启动路径是用户的根目录,东西太多太乱了. 2.修改很容易,右键单击桌面的快捷方式,选择“属性”. 3.删除“目录”中的 --cd-to-home 选项,再将“起始位置&quo ...

  3. oracle trim函数用法详解

    在oracle数据库中,trim一般都是用在删除字符串两边的空格.实际上,trim也可以用来删除字符串两边的指定字符.并且trim指定删除的字符串只能是单个字符Oracle TRIM函数是很常见的函数 ...

  4. Atitit mybatis 3 3.2 3.3  3.4 新特性attilax总结

    Atitit mybatis 3 3.2 3.3  3.4 新特性attilax总结 1.1. iBATIS 3 内的新特性.html1 1.2. MyBatis团队于2013年2月21日正式发布 M ...

  5. [na]tcpdump非常实用的抓包实例

    基本语法篇 常用应用: 过滤物理口 过滤某个port/ip/mac 过滤协议 显示ip/mac/port不解析等 过滤mac tcpdump -i eth0 ether host 24:DF:6A:F ...

  6. android 中毛玻璃效果的实现

    最近在做一款叫叽叽的App(男银懂的),其中有一个功能需要对图片处理实现毛玻璃的特效 进过一番预研,找到了3中实现方案,其中各有优缺点: 1.如果系统的api在16以上,可以使用系统提供的方法直接处理 ...

  7. gf框架之grpool - 高性能的goroutine池

    Go语言中的goroutine虽然相对于系统线程来说比较轻量级,但是在高并发量下的goroutine频繁创建和销毁对于性能损耗以及GC来说压力也不小.充分将goroutine复用,减少goroutin ...

  8. 菜鸟学SSH(十七)——基于注解的SSH将配置精简到极致

    很早之前就想写一篇关于SSH整合的博客了,但是一直觉得使用SSH的时候那么多的配置文件,严重破坏了我们代码整体性,比如你要看两个实体的关系还得对照*.hbm.xml文件,要屡清一个Action可能需要 ...

  9. 服务器搭建3 安装libevent2.0.20

    1.检测是否安装 安装了的话应该是这样的:如果不是,那就装一下. root@iZ23nyl8frqZ:/home/upload# ls -a /usr/lib |grep libeventlibeve ...

  10. convert2utf8withbom

    很久以前给同事要的转码bash 当时windows和mac总是出现中文注释乱码的情况,让人心塞的难过.又因为是老项目,现有源码太多了,不可能改模板重新创建.只能跑一遍这个玩意儿了…… #!/bin/b ...