个人导航样式详解

零、参考

https://github.com/creativetimofficial/vue-light-bootstrap-dashboard

一、实战解析

分解:外层wrapper + 左边的sidebar + 右边的main-panel

0.全局样式

0.1滚动条样式(仅限chrome):https://www.jianshu.com/p/bbd62666cb62
【selector::-webkit-scrollbar可以选择对应的滚动条】

1.wrapper

1.1高度设置为视窗的100%

height: 100vh

2.sidebar

2.0基础样式

overflow:auto; /*内容溢出会出现滚动条*/
width: 260px; /*设置了宽度*/
。。。

2.1给sidebar添加蒙版效果(阴影百搭配色)

/*给sidebar添加蒙板效果*/
.sidebar:before, .sidebar:after{
    display: block;
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 2;
}
.sidebar:before{
    opacity: .33;
    background: #000;
}
.sidebar:after{
    opacity: .33;
    background: linear-gradient(180deg,#292929,#0e0e0e);
    background-size: 150% 150%;
}

3.main-panel

~CSS的HSLA色彩模式:https://www.cnblogs.com/zhoushengxiu/p/5710691.html

background: hsla(240,7%,81%,.15);
position: relative;
float: right; /*右浮动*/
width: calc(100% - 260px); /*算出去掉sidebar后生剩下的宽度*/
。。。
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

友情链接更多精彩内容