[CSS] Reduce Ambiguity in Class Names using a Naming Convention
2024-08-31 20:45:03
A solid naming convention makes it less likely to run into naming conflicts and helps establish a semantic pattern that is easier for a team to follow. In this lesson, I'm using a variation of the BEM (Block Element Model) naming convention. OOCSS and SMACSS offer similar methodologies. I also use the class attribute selector to target multiple modifier classes.
.todo-list {
list-style: none;
margin:;
padding:;
width: 100%;
order: -1;
display: flex;
flex-direction: column;
}
[class^="todo-list__item"] {
cursor: pointer;
height: 80px;
display: block;
text-transform: uppercase;
color: #af544f;
letter-spacing: 2px;
box-sizing: border-box;
padding: 27px 33px 0 78px;
box-shadow: 0 1px 0 0 #e6e6e6, 0 2px 0 0 white;
background-image: url('https://jsbin-user-assets.s3.amazonaws.com/GarthDB/box.svg');
background-repeat: no-repeat;
background-position: 28px 16px;
}
.todo-list__item--completed {
color: #16a085;
background-image: url('https://jsbin-user-assets.s3.amazonaws.com/GarthDB/done.svg')
}
const Todo = ({
onClick,
completed,
text
}) => (
<li
onClick={onClick}
className={
completed ?
"todo-list__item--completed" :
"todo-list__item--active"
}
>
{text}
</li>
);
最新文章
- WINDOWS窗口风格 WS_OVERLAPPEDWINDOW
- Kali Linux 秘籍/Web渗透秘籍/无线渗透入门
- Java开发之文件上传
- C#.NET 大型通用信息化系统集成快速开发平台 4.0 版本 - 用户权限树的实现 -- 权限递归树
- LeetCode&mdash;&mdash;Rotate Image(二维数组顺时针旋转90度)
- 3----lua的数据转换及运算符
- java新手笔记18 类比较
- 服务器是windows时tomcat无法打印所有日志配置修改
- webpack配置这一篇就够
- 关于CoordinatorLayout的用法——复杂交互的克星
- 26 python 初学(线程、同步锁、死锁和递归锁)
- 全局css控制<;td>;标签属性
- python获取机器信息脚本(网上寻找的)
- python学习笔记(5-1)-基本数据类型-字符串类型及操作
- Vue--路由
- MySQL DBA工作角色和职责介绍
- 计算属性和监听,computed,watch
- python中收集函数的解包问题
- 卸载Myeclipse10.5 报错“an error has occured.See the log file ...Uninstaller\...”
- 【POJ1187】陨石的秘密
热门文章
- dlopen 方式调用 Linux 的动态链接库
- 【翻译自mos文章】OGG的集成捕捉模式支持Oracle database标准版么?
- Android-CheckBox 实现计算器
- java中异常的限制
- 6.Windows 二进制文件 (.exe)安装--终端安装
- ubuntu14.04.32 vmware11开发环境搭建
- C# 中 int、Convert.ToInt32()、int.Parse()的区别
- Vue的学习--怎么在vue-cli中写网页
- BZOJ2733: [HNOI2012]永无乡(线段树合并)
- 【2017 Multi-University Training Contest - Team 9】Numbers