zoukankan      html  css  js  c++  java
  • 我的CSS命名规则

    常见class关键词:

    • 布局类:header, footer, container, main, content, aside, page, section
    • 包裹类:wrap, inner
    • 区块类:region, block, box
    • 结构类:hd, bd, ft, top, bottom, left, right, middle, col, row, grid, span
    • 列表类:list, item, field
    • 主次类:primary, secondary, sub, minor
    • 大小类:s, m, l, xl, large, small
    • 状态类:active, current, checked, hover, fail, success, warn, error, on, off
    • 导航类:nav, prev, next, breadcrumb, forward, back, indicator, paging, first, last
    • 交互类:tips, alert, modal, pop, panel, tabs, accordion, slide, scroll, overlay,
    • 星级类:rate, star
    • 分割类:group, seperate, divider
    • 等分类:full, half, third, quarter
    • 表格类:table, tr, td, cell, row
    • 图片类:img, thumbnail, original, album, gallery
    • 语言类:cn, en
    • 论坛类:forum, bbs, topic, post
    • 方向类:up, down, left, right
    • 其他语义类:btn, close, ok, cancel, switch; link, title, info, intro, more, icon; form, label, search, contact, phone, date, email, user; view, loading...

    有了关键词之后,我们先来制定一些简单的规则

    制定简单规则:

    • 以中划线连接,如.item-img
    • 使用两个中划线表示特殊化,如.item-img.item-img--small表示在.item-img的基础上特殊化
    • 状态类直接使用单词,参考上面的关键词,如.active, .checked
    • 图标以icon-为前缀(字体图标采用.icon-font.i-name方式命名)。
    • 模块采用关键词命名,如.slide, .modal, .tips, .tabs,特殊化采用上面两个中划线表示,如.imgslide--full, .modal--pay, .tips--up, .tabs--simple
    • js操作的类统一加上js-前缀
    • 不要超过四个class组合使用,如.a.b.c.d

    关键词及规则都有了,现在可以进入本文的核心的核心,实战操作。

  • 相关阅读:
    数学+高精度 ZOJ 2313 Chinese Girls' Amusement
    最短路(Bellman_Ford) POJ 1860 Currency Exchange
    贪心 Gym 100502E Opening Ceremony
    概率 Gym 100502D Dice Game
    判断 Gym 100502K Train Passengers
    BFS POJ 3278 Catch That Cow
    DFS POJ 2362 Square
    DFS ZOJ 1002/HDOJ 1045 Fire Net
    组合数学(全排列)+DFS CSU 1563 Lexicography
    stack UVA 442 Matrix Chain Multiplication
  • 原文地址:https://www.cnblogs.com/xuange306/p/6285403.html
Copyright © 2011-2022 走看看