gpt4 book ai didi

html - 在 Bootstrap 仪表板模板示例中设置特定的侧边栏宽度

转载 作者:行者123 更新时间:2023-11-28 10:51:08 25 4
gpt4 key购买 nike

我正在使用 Bootstrap 附带的仪表板模板示例。侧边栏在一定屏幕尺寸后消失,这很好。但是我想在那之前设置一个特定的宽度。现在它在更大的屏幕上具有响应性和宽度拉伸(stretch)(在大显示器上有点令人讨厌。)一个好的宽度是 250px

CSS

/*
* Base structure
*/

/* Move down content because we have a fixed navbar that is 50px tall */
body {
padding-top: 50px;
}


/*
* Global add-ons
*/

.sub-header {
padding-bottom: 10px;
border-bottom: 1px solid #eee;
}


/*
* Sidebar
*/

/* Hide for mobile, show later */
.sidebar {
display: none;
}
@media (min-width: 768px) {
.sidebar {
position: fixed;
top: 51px;
bottom: 0;
left: 0;
z-index: 1000;
display: block;
padding: 20px;
overflow-x: hidden;
overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
background-color: #31373d;
border-right: 1px solid #eee;
}
}

/* Sidebar navigation */
.nav-sidebar {
margin-right: -21px; /* 20px padding + 1px border */
margin-bottom: 20px;
margin-left: -20px;
}
.nav-sidebar > li > a {
padding-right: 20px;
padding-left: 20px;
color: #98a7b5;
}

.nav-sidebar > li > a:hover {
background: transparent;
color: #fff;
}

.nav-sidebar > .active > a, .nav-sidebar > li > a:hover {
color: #fff;
background-color: #272c30;
}


/*
* Main content
*/

.main {
padding: 20px;
}
@media (min-width: 768px) {
.main {
padding-right: 40px;
padding-left: 40px;
}
}
.main .page-header {
margin-top: 0;
}


/*
* Placeholder dashboard ideas
*/

.placeholders {
margin-bottom: 30px;
text-align: center;
}
.placeholders h4 {
margin-bottom: 0;
}
.placeholder {
margin-bottom: 20px;
}
.placeholder img {
display: inline-block;
border-radius: 50%;
}

有什么想法吗?谢谢。源代码可在 getbootstrap.com 获得

最佳答案

.sidebar CSS 中的 max-width: 250px 怎么样?

关于html - 在 Bootstrap 仪表板模板示例中设置特定的侧边栏宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22787165/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com