HTML 缩写
元素快捷方式
div生成
p生成

h1生成

a生成
img生成
input生成
btn生成
link:cssCSS 样式表 link 标签
HTML 模板
! → full HTML5 boilerplate doc → HTML5 doctype only
隐式标签
.class解析为
ul>.item子元素解析为
  • table>.row子元素解析为
    select>.opt子元素解析为
    嵌套
    嵌套运算符
    >子元素
    +同级元素
    ^向上一级
    ^^向上两级
    嵌套示例
    div>ul>li → nested child elements div+p+footer → sibling elements div>p>span^h2 → climb up: h2 is sibling of p div>p>span^^h2 → climb up twice: h2 sibling of div
    分组
    括号分组
    div>(header>nav)+main+footer → groups header>nav as a unit (div>h2+p)*3 → repeat grouped structure 3 times
    复杂布局
    .container>(header>h1+nav>ul>li*3)+main+footer → full page layout skeleton
    乘法
    重复运算符
    li*5生成 5 个
  • 元素
  • div>p*3div 包含 3 个子段落
    ul>li*4>a4 个列表项,每项含链接
    tr>td*4含 4 个单元格的表格行
    乘法示例
    ul>li.item*5 → 5 list items with class table>tr*3>td*4 → 3x4 table grid .row>.col*3>p{Content} → 3-column row with text
    编号
    项目编号($)
    $顺序编号(1, 2, 3...)
    $$两位零填充(01, 02...)
    $$$三位零填充(001, 002...)
    $@3从 3 开始编号
    $@-倒序编号(递减)
    $@-3从 3 开始倒序
    编号示例
    li.item$*3 → item1, item2, item3 li.item$$*3 → item01, item02, item03 li.item$@3*3 → item3, item4, item5
    属性
    ID 与 Class
    #id添加 id 属性:
    .class添加 class:
    .c1.c2多个 class:class="c1 c2"
    #main.containerID + class 组合
    自定义属性
    td[colspan=2] → a[href=#]{Click} → Click input[type=email placeholder=Email] div[data-id=$]*3 → data-id="1", "2", "3"
    文本
    文本内容({})
    p{Hello}

    Hello

    a{Click me}Click me
    p{Item $}*3Item 1, Item 2, Item 3
    文本与嵌套
    p>{Click }+a{here}+{ to continue} →

    Click here to continue

    ul>li{Item $}*4 → list with numbered items
    CSS 缩写
    盒模型
    m10margin: 10px;
    m10-20margin: 10px 20px;
    p10padding: 10px;
    w100width: 100px;
    w100pwidth: 100%;
    h50height: 50px;
    显示与定位
    d:fdisplay: flex;
    d:gdisplay: grid;
    d:ndisplay: none;
    d:bdisplay: block;
    pos:rposition: relative;
    pos:aposition: absolute;
    Flexbox
    jc:cjustify-content: center;
    jc:sbjustify-content: space-between;
    ai:calign-items: center;
    fxd:cflex-direction: column;
    fw:wflex-wrap: wrap;
    字体与颜色
    fz14font-size: 14px;
    fw:bfont-weight: bold;
    ta:ctext-align: center;
    c:#333color: #333;
    bgc:#fffbackground-color: #fff;