style: optimize sidebar position css

This commit is contained in:
XPoet 2020-04-29 16:37:13 +08:00
parent 000e167e90
commit 7bca61bb3e
1 changed files with 18 additions and 6 deletions

View File

@ -28,23 +28,35 @@
position: relative; position: relative;
box-sizing: border-box; box-sizing: border-box;
if (hexo-config('magic.enable') && hexo-config('magic.sidebar.enable') == true) { if (hexo-config('magic.enable') && hexo-config('magic.sidebar.enable')) {
padding-right: $sidebar-width + $component-interspace; if (hexo-config('magic.sidebar.position') == left) {
padding-left: $sidebar-width + $component-interspace;
} else {
padding-right: $sidebar-width + $component-interspace;
}
.main-content-right { .main-content-right {
position: absolute; position: absolute;
right: 0;
if (hexo-config('magic.sidebar.position') == left) {
left: 0;
} else {
right: 0;
}
width: $sidebar-width; width: $sidebar-width;
box-sizing: border-box; box-sizing: border-box;
} }
} }
.main-content-left { .main-content-left {
position: relative; position: relative;
float: left; if (hexo-config('magic.sidebar.position') == left) {
float: right;
} else {
float: left;
}
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
} }