rogerxu / rogerxu.github.io

Roger Xu's Blog
3 stars 2 forks source link

CSS #39

Open rogerxu opened 7 years ago

rogerxu commented 7 years ago

CSS教程 | 王鹏飞 (pengfeixc.com)

5 things you don't need Javascript for (lexoral.com)

rogerxu commented 7 years ago

rem

Understanding and Using rem Units in CSS REM vs EM – The Great Debate | Zell Liew

rogerxu commented 7 years ago

Targeting Page Content

The universal selector

Grouping selectors

Descendant selectors

Child selectors

Adjacent selectors

Attribute selectors

Pseudo-class selectors

Pseudo-element selectors

Generate content

a::after {
  content: " [" attr(href) "] ";
  color: green;
}
rogerxu commented 7 years ago

Resolving Conflicts

Understanding the cascade

Last one wins.

Using inheritance

Selector specificity

The !important declaration

Try to avoid to use important

rogerxu commented 7 years ago

Basic Text Formatting

Font style properties

font-family

font-size

font-style: normal, italic, oblique

font-weight: normal, lighter, bold, bolder, 100~900

font-variant: small-caps

Font format shorthands

font

Text style properties

text-decoration: underline, line-through, blink

line-height: 1.5

text-align: center, justify

hyphens: auto

letter-spacing

word-spacing

text-indent: 1em, -2000em

rogerxu commented 7 years ago

Styling Container Elements

Background

background-attachment

background-position

Corresponding percentage points are mapped on both the background image and the element. The points are then aligned to determine the background image's position.

50% 50% - horizontal, vertical

rogerxu commented 7 years ago

Working with Color

color words

rbg

hsl

opacity

box-shadow

text-shadow

gradient

rogerxu commented 7 years ago

High-Definition Screens

Background Images

High Definition Sizes

@media screen and (min-device-pixel-ratio: 2) {
  header {
    background-image: url(../img/banner_1200_@2x.png);
  }
}

Images

<img src="img/photo.png" srcset="img/photo.png 1x, img/photo_@2x.png 2x" />
rogerxu commented 6 years ago

Naming Conventions

An introduction to CSS Methodologies: Naming Conventions and File Structures by Danielle on CodePen

值得参考的css理论:OOCSS、SMACSS与BEM - 庭院茶 - SegmentFault 思否

css可维护方案:OOCSS VS BEM - 掘金

BEM

BEM — Block Element Modifier

理解 CSS 命名规范 --BEM - 前端 - 掘金

<div class="block">
    <div class="block__elem1">
        <div class="block__elem2">
            <div class="block__elem3"></div>
        </div>
    </div>
</div>

OOCSS

Object-Oriented CSS

More like a concept - doesn’t have standard naming conventions and can play well with BEM as the goals are the same: code reuse.

Separating Structure From Skin

Separating Container From Content

SMACSS

Scalable and Modular Architecture for CSS

ITCSS

ITCSS: Scalable and Maintainable CSS Architecture

Inverted Triangle CSS: Scalable and maintainable