CSS Architecture & CSS Design Patterns
CSS Architecture & CSS Design Patterns
BEM
Block, Element, Modifier
https://en.bem.info/methodology/quick-start/
OOCSS
Separate structure and skin(分离结构和主题)
Separate container and content(分离容器和内容)
SMACSS
Base(基础)
Layout(布局)
Modules(模块)
State(状态)
Theme(主题)
Enduring CSS
React
- CSS Modules
- CSS in JS
- styled-components
demo
https://codepen.io/xgqfrms/pen/LYGeYGo?editors=0010
https://cdnjs.cloudflare.com/ajax/libs/styled-components/3.2.1/styled-components.js
https://styled-components.com/
import styled from 'styled-components';
const Button = styled.button``;
// This Button variable here is now a React component that you can use like any other React component!
const Button = styled.button`
background: transparent;
border-radius: 3px;
border: 2px solid palevioletred;
color: palevioletred;
margin: 0.5em 1em;
padding: 0.25em 1em;
${props => props.primary && css`
background: palevioletred;
color: white;
`}
`;
const Container = styled.div`
text-align: center;
`
render(
<Container>
<Button>Normal Button</Button>
<Button primary>Primary Button</Button>
</Container>
);
SCSS
CSS 3
- var
- themes/ skins (dark mode)
CSS 选择器的性能优化
CSS选择器从右到左匹配的机制,只要当前选择符的左边还有其他选择符,样式系统就会继续向左移动,直到找到和规则匹配的选择符,或不匹配而退出;
把最右边选择符
称为关键选择器
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/13151728.html
未经授权禁止转载,违者必究!
分类:
CSS3
标签:
CSS in JS
, CSS Architecture
, CSS
, BEM
, CSS Modules
, CSS Design Patterns
, OOCSS
, SMACSS
, styled components
, styled-components
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
2019-06-17 CSS3 & content & attr & data-* All In One
2019-06-17 js & array remove one item ways
2019-06-17 CSS3 customize checkbox & checkbox image & css checkbox All In One
2019-06-17 css & background-image & full page width & background-size
2019-06-17 vue @ path
2016-06-17 WebIDE
2016-06-17 i18n 和 L10n (internationalization and localization) All In One