关于css:一些CSS小技巧

4次阅读

共计 563 个字符,预计需要花费 2 分钟才能阅读完成。

参考及举荐:前端优良实际不齐全指南

1: 右边定宽(250px), 左边宽度自适应

flex:

.g-app-wrapper {
    display: flex;
    min-width: 1200px;
}
.g-sidebar {
    flex-basis: 250px;
    margin-right: 10px;
}
.g-main {flex-grow: 1;}

float:

.g-app-wrapper{width:100%;}
.g-app-wrapper.clearfix:after {
    content: "";
    display: block;
    clear: both;
}
.g-sidebar {
    width: 250px;
    float:left;
}
.g-main {margin-left: 250px;}

2: 页面中可适当增加不可选中内容,比方按钮等

.btn{
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10 and IE 11 */
    user-select: none; /* Standard syntax */
}

3: 鼠标应用状况上来除元素 focus, 键盘状况下保留 focus

input:focus {outline: 1px solid red;}
input:focus:not(:focus-visible) {outline: none;}
正文完
 0