Skip to content

用CSS的伪类实现对和叉号 #5

Description

@AlexZ33
<span class="true"></span>
.true {
    margin-right: 20px;
    display: inline-block;
    width: 8px;
    height: 4px;
    background: green;
    line-height: 0;
    font-size: 0;
    vertical-align: middle;
    transform: rotate(45deg);
}
.true:after { 
    content: '/';
    display: block;
    width: 18px;
    height: 4px;
    background: green;
}
```

测试:通过 绝对定位position: absolute;left: 11px;方式将伪类内容显示在页面上,方便测试。
注意:after伪类的内容为"/",但显示时候为""。
问题:对伪类内容添加的位置

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions