CSS Notes
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的更多相关文章
- CSS编写指导规范和建议
在参与规模庞大.历时漫长且参与人数众多的项目时,所有开发者遵守如下规则极为重要: 保持 CSS 易于维护 保持代码清晰易懂 保持 CSS 的可拓展性 为了实现这一目标,我们要采用诸多方法. 本文档第一 ...
- 各式 Web 前端開發工具整理
程式碼編寫工具 (Coding Tools) 工作流程/建置/組合 (Workflow/Builds/Assemblers) lumbar brunch grunt lineman yeoman Ta ...
- sequelize 学习之路
如果你觉得Sequelize的文档有点多.杂,不方便看,可以看看这篇. 在使用NodeJS来关系型操作数据库时,为了方便,通常都会选择一个合适的ORM(Object Relationship Mode ...
- Sequelize 和 MySQL 对照Sequelize 和 MySQL 对照
安装 这篇文章主要使用MySQL.Sequelize.co来进行介绍.安装非常简单: $ npm install --save co $ npm install --save sequelize $ ...
- Matplotlib数据可视化(3):文本与轴
在一幅图表中,文本.坐标轴和图像的是信息传递的核心,对着三者的设置是作图这最为关心的内容,在上一篇博客中虽然列举了一些设置方法,但没有进行深入介绍,本文以围绕如何对文本和坐标轴进行设置展开(对图像 ...
- 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 ...
- Learning Notes for HTML/CSS/JS
@1:内部样式表 & 外部样式表 内部样式表的定义,放在<style></style>中,<style>标签放在<head>中 <html ...
- CSS字体记录
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaYAAACnCAIAAADVOG9FAAAgAElEQVR4nOy9eXwcxZk/vL/9ve8eb7 ...
- 开始编写CSS
本文由大漠根据Krasimir Tsonev的<Starting to Write CSS>所译,整个译文带有我们自己的理解与思想,如果译得不好或不对之处还请同行朋友指点.如需转载此译文, ...
随机推荐
- 【python】Python 资源大全中文版
申明:感谢原作者的整理与分享,本篇文章分享自:https://www.jianshu.com/p/9c6ae64a1bd7 GitHub 上有一个 Awesome - XXX 系列的资源整理,资源非常 ...
- Guid ToString 格式
转自 http://www.cnblogs.com/greenerycn/archive/2010/04/25/guid_tostring_format.html 在日常编程中,Guid是比较常用的, ...
- sudo 的介绍
http://chenfage.blog.51cto.com/8804946/1830424
- Android设计元素-操作栏
原文链接:http://android.eoe.cn/topic/android_sdk 操作栏 - Action Bar “操作栏”对于 Android 应用来说是最重要的设计元素.它通常在应用运行 ...
- 高效开发iOS系列 -- 那些不为人知的KVC
我的简书地址:http://www.jianshu.com/p/a6a0abac1c4a valueForKeyPath 本篇来解说一下那些不为人知,也常常被忽略掉,而且非常有用的KVC干货小技巧 获 ...
- Vivado+FPGA:如何使用Debug Cores(ILA)在线调试(烧录到flash里可以直接启动)
在Vivado下在线调试是利用ILA进行的,Xilinx官方给出了一个视频,演示了如何使用Vivado的debug cores,下面我根据这个官方视频的截图的来演示一下: 官方的视频使用的软件版本为2 ...
- 【Android】1.0 第1章 C#之Android手机App开发
分类:C#.Android.VS2015:创建日期:2016-01-20 目前Android在全世界市场上大约有75%的占有率,国人Android手机的持有比例更甚,甚至达到90%以上.因此搞计算机的 ...
- PS辅助工具Assistor PS
Assistor PS是一个功能强大的PS辅助工具,它可以切图.标坐标.尺寸.文字样式注释.画参考线等功能,可以为设计师节省很多时间.该PS工具原本需要每月付费$9.99美元,但在今年6月开始,将免费 ...
- 使用flow捕获js错误提高代码质量
本文将介绍Flow及其主特性.下面分别从如何安装设置,如何添加类型注释,如何在运行时自动去掉注释等方面来介绍. 安装 目前Flow兼容的操作系统有Mac OS X,Linux(64位),Windows ...
- 从头开始学习vue-router
一.前言 要学习vue-router就要先知道这里的路由是什么?为什么我们不能像原来一样直接用标签编写链接哪?vue-router如何使用?常见路由操作有哪些?等等这些问题,就是本篇要探讨的主要问题. ...