秦小

秦小军的网络日志


  • 首页

  • 归档

  • 分类

  • 标签

  • 关于
秦小

CSSMM4E 笔记 - 1.00 - CSS 基础

发表于 2016-04-04 | 分类于 Web

这是 “CSS: The Missing Manual 4E” 第一分的笔记. 这部分介绍CSS 的基础知识, 包括 1. HTML and CSS基本语法, HTML结构.

  1. 向HTML引入CSS 的方法. 3. 重点选择器语法. 4. Style Inheritance. 5. CSS 层叠作用原理.

HTML 和 CSS

HTML 用于控制页面内容结构. 应使用更具语义的HTML5标签.

html验证: 1. http://validator.w3.org/ 2. 浏览器插件

  • div - division
  • header -
  • article -
  • section - 包含一组相关的内容,比如书本的章节
  • aside - 在一些内容相关旁边(aside)放置一些相关的内容
  • footer - 包含通常放在页面底部(footer)的的信息,但不限于页面底部, 也可以是其他内容(比如article, section等)的底部
  • nav - 主要的导航链接
  • figure - 用于解释(illustrative)图片

创建样式(styles)和样式表(style sheets)

CSS验证: http://jigsaw.w3.org/css-validator/

内联的:

1
<style> ... </style>

外部的:

1
<link rel="stylesheet" href="css/style.css">

选择器(selectors): 识别样式应用目标

  • 类型选择器: 标签
  • 类选择器: .classname
    在一个标签(tag)上使用多个类,可以共享css样式

    1
    2
    3
    4
    .btn {}
    .delete {}
    .add {}
    .edit {}
    1
    2
    3
    <button class="btn add">Add</button>
    <button class="btn delete">Delete</button>
    <button class="btn edit">Edit</button>
  • ID选择器: 特定的文档元素 Note: 少用

  • 选择器组
    • h1, h2, h3, h4, p, .copyright {}
    • * {}
  • 对标签内的标签引用样式

    • 后代选择器: h1 .strong {}
    • 创建模块:

      1
      2
      3
      4
      5
      <div class="contact">
      <p class="name">Jonh Smith</p>
      <p class="phone">555-555-1234</p>
      <p class="address">1234 Elem St</p>
      </div>
      1
      2
      3
      .contact .name {}
      .contact .phone {}
      .contact .address {}
  • 伪类(Pesudo-Class) & 伪元素(Pesudo-Elements)

    • 链接(a)
      a:link regular, unused link
      a:visited 已访问
      a:hover hover
      a:active 已点击, 未释放
    • 段落(p)
      ::first-letter
      ::first-line
    • :focus
    • ::before 在前面插入文字 ::before { content: "text to insert" }
    • ::after
    • ::selection refers to items that a visitor has selected on a page. 比如: 选种的文字
      Note: firefox -> ::-moz-selection
  • 属性(Attribute)选择器
    • img[title] has attribute
    • input[type="text"] type == “text”
    • a[href^="http://"] href starts with …
    • a[href$=".pdf"] href ends with …
    • img[src*="headshot"] src contains …
  • 孩子(Child)选择器

    • div > p
    • :first-child
    • :last-child
    • :only-child
    • :nth-child(odd) or :nth-chlid(even) or :nth-child(an+b) [a=1..., b=0...]
    • :first-of-type

      VS: p:first-of-type 可以 选择下面的 p, 但是 first-child 不能

      1
      2
      3
      4
      <div>
      <h2>A heading</h2>
      <p>A paragraph.</p>
      </div>
    • :last-of-type

    • :nth-of-type(xxx)
  • 兄弟选择器
    • h2 + p 毗邻(p紧跟在h2后面)[adjacent (p immediately after h2)]
    • h2 ~ p all
  • :taget 选择器 – 当 window.location.href == index.html#targetX 时对应的链接<a id="targetX">被选中.
  • :not() 选择器

    1
    2
    p:not(.classy) {}
    a[href^="http://"]:not([href^="http://mysite.com"]) {}

使用样式继承(Inheritance)节约时间

  • 通常, 影响元素占位的properties不inherited: margin, background color, border.
  • 浏览器固有的properties不inherited: Headings are big and bold, links are blue…

多样式: 层叠(Cascade)的本质

层叠式CSS的基本机制,它规定了样式之间怎样相互作用,当有冲突是哪个样式有限应用.

  • 样式怎样层叠

    • 继承样式积累
      • 距离最近的样式优先
      • 直接样式优先
    • Specificity: Which Style Wins
      tag: 1 point | class: 10 points | ID: 100 points | inline: 1000 points|
      • The Tie-Breaker: Last Style Wins
  • 掌控层叠

    • 改变Specificity - !important 只用作 test/debug
    • 选择性覆盖(Overriding)
    • 避免 Specificity 竞赛(wars) - 慎用(be cautions of) ID selectors
    • 以一个清爽的蓝本(Slate)开始 - reset.css
秦小

CSSMM4E 笔记 - 0.00 - CSS: The Missing Manual 4E 中所有连接

发表于 2016-04-04 | 分类于 Web

为了方便访问”CSS: The Missing Manual 4E”中的链接, 我将其整理在一起了.

Start

  • html验证

    1. http://validator.w3.org/
    2. 浏览器插件
  • CSS验证 http://jigsaw.w3.org/css-validator/

  • Starting with a Clean Slate

    • reset.css http://meyerweb.com/eric/tools/css/reset
    • normalize css
  • Autoprefixer
  • CSS Minifier http://cssminifier.com/
  • Witch css fethure I can use in brosers? Witch css fethure I can use in brosers?
  • Sass see https://sass-lang.com

Fonts

  • The League of Movable Type https://www.theleagueofmoveabletype.com/
  • Exljbris font foundry http://www.exljbris.com/
  • The Open font Library http://openfontlibrary.org
  • Font Squirrel https://www.fontsquirrel.com
  • Google Fonts https://www.google.com/fonts
  • using https://www.fontsquirrel.com/tools/webfont-generator

Images

  • http://foter.com
  • https://unsplash.com
  • http://www.morguefile.com
  • http://www.freeimages.com
  • http://openphoto.net
  • http://search.creativecommons.org
  • http://www.flickr.com/creativecommons
  • ICON: http://www.flaticon.com
  • ICON: http://www.somerandomdude.com/work/sanscons/
  • Tiling patterns: http://www.colourlovers.com/patterns
  • Tiling patterns: http://www.kollermedia.at/pattern4u
  • Tiling patterns: http://squidfingers.com/patterns
  • Tiling patterns2: http://bgpatterns.com
  • Tiling patterns2: http://stripegenerator.com
  • Tiling patterns2: http://patterncooler.com

Dropdown Menu

  • http://blog.teamtreehouse.com/create-simple-css-dropdown-menu
  • http://www.red-team-design.com/css3-animated-dropdown-menu
  • http://purecssmenu.com
  • https://css-tricks.com/drop-down-menus-with-more-forgiving-mouse-movement-paths

Animations

  • 3D transforms: http://coding.smashingmagazine.com/2012/01/06/adventures-in-the-third-dimension-css-3-d-transforms/
  • 3D transforms: http://desandro.github.io/3dtransforms/
  • http://www.webkit.org/blog-files/3d-transforms/morphing-cubes.html
  • http://davidwalsh.name/css-flip
  • Animatable properties: complete list: https://www.w3.org/TR/css3-transitions/#animatable-properties
  • Timing: http://www.the-art-of-web.com/css/timing-function/
  • Cubic Bezier: https://matthewlein.com/ceaser/
  • css3 pseudo & html5 forms: http://html5doctor.com/css3-pseudo-classes-and-html5-forms/

Layout

  • Mobile First
    • https://abookapart.com/products/mobile-first
    • http://www.sitepoint.com/making-case-mobile-first-designs/
  • https://developer.yahoo.com/ypatterns/wireframes/
  • http://blog.html.it/
  • http://templated.co/
  • Multiple Columns
    • http://www.pagecolumn.com/
    • https://www.w3.org/TR/css3-multicol/
    • https://dev.opera.com/articles/css3-multi-column-layout/
    • http://aaronlumsden.com/multicol/
  • Why Containing Floats Bring Problems why?
  • Equal Height Columns: First other way Second other way
  • Tooltips:
    • css tooltip: http://www.menucool.com/tooltip/css3-tooltip
    • http://qtip2.com//
  • Responsive Web Design ref
  • Media Queries w3 ref
  • Responsive Navigation
    • http://alistapart.com/article/responsive-web-design
    • http://exisweb.net/incredibly-useful-list-of-responsive-navigation-and-menu-patterns
    • http://bradfrost.com/blog/web/complex-navigation-patterns-for-responsive-design/
  • Responsive Images
    • http://alistapart.com/article/responsive-images-in-practice
    • Adaptive images: http://adaptive-images.com/
  • Embed Videos
    • videos using iframe: http://thenewcode.com/649/Responsive-Design-Create-Fluid-YouTube-amp-Vimeo-Content
    • Embed Responsively service: http://embedresponsively.com/

Grid System

  • Skeleton: http://getskeleton.com
  • Simple Grid: http://thisisdallas.github.io/Simple-Grid/
  • Pure.css[framework]: http://purecss.io/
  • Foundation[framework]: http://foundation.zurb.com/
  • Bootstrap[framework]: http://getbootstrap.com/

Flexbox

  • flexbox 救苍生: http://philipwalton.github.io/solved-by-flexbox/
  • w3 - flexbox: https://drafts.csswg.org/css-flexbox/

Object Oriented CSS

  • Object Oriented CSS https://www.smashingmagazine.com/2011/12/an-introduction-to-object-oriented-css-oocss/
  • Object Oriented CSS https://github.com/stubbornella/oocss
  • Scalable and Modular Architecture ofr CSS https://smacss.com/
  • Scalable and Modular Architecture ofr CSS http://tv.adobe.com/watch/adc-presents/smacss-introduction-to-a-scalable-and-modular-architecture-for-css/
123
qinxij

qinxij

22 日志
3 分类
6 标签
© 2017 qinxij
由 Hexo 强力驱动
主题 - NexT.Pisces