Open rogerxu opened 7 years ago
*
aside, article, section
header h1
article > h2
h2 + p
p[class~="red"]
a:link
a:visited
a:hover
a:active
span:first-child
h2:first-of-type
p:only-child
p:nth-child(2n+1)
p:nth-child(odd)
p::first-line
p::first-letter
Generate content
a::after {
content: " [" attr(href) "] ";
color: green;
}
Last one wins.
Try to avoid to use important
font-family
font-size
font-style
: normal, italic, oblique
font-weight
: normal, lighter, bold, bolder, 100~900
font-variant
: small-caps
font
text-decoration
: underline, line-through, blink
line-height
: 1.5
text-align
: center, justify
hyphens
: auto
letter-spacing
word-spacing
text-indent
: 1em, -2000em
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
color words
rbg
hsl
opacity
box-shadow
text-shadow
gradient
@media screen and (min-device-pixel-ratio: 2) {
header {
background-image: url(../img/banner_1200_@2x.png);
}
}
<img src="img/photo.png" srcset="img/photo.png 1x, img/photo_@2x.png 2x" />
An introduction to CSS Methodologies: Naming Conventions and File Structures by Danielle on CodePen
值得参考的css理论:OOCSS、SMACSS与BEM - 庭院茶 - SegmentFault 思否
block-name__element-name_modifier-name_modifier-value
block-name__element-name--modifier-name
<div class="block">
<div class="block__elem1">
<div class="block__elem2">
<div class="block__elem3"></div>
</div>
</div>
</div>
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
Scalable and Modular Architecture for CSS
ITCSS: Scalable and Maintainable CSS Architecture
Inverted Triangle CSS: Scalable and maintainable
CSS教程 | 王鹏飞 (pengfeixc.com)
5 things you don't need Javascript for (lexoral.com)