参考及推荐:前端优秀实践不完全指南

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;
}

charlotteeeeeee
74 声望7 粉丝