简体   繁体   English

在引导程序中使用Scrollpane并覆盖CSS

[英]Using Scrollpane in bootstrap and override CSS

I want to use a Scrollpane to horizontally scroll to a forecast. 我想使用滚动窗格水平滚动到预测。

I've updated my file and saved it under the name bootstrap_and_customization.css in my css folder: 我已经更新了文件并将其保存为css文件夹中的bootstrap_and_customization.css名称:

@import 'bootstrap';
@import url(http://fonts.googleapis.com/css?family=Lato:400,700);
#Forecast ul {
float: left;
width: 100%;
padding: 0;
margin: 0;
list-style-type: none;
white-space: nowrap;
}
#Forecast ul li div {
float: left;
text-decoration: none;
color: white;
background-color: purple;
padding: 0.2em 0.6em;
border-right: 1px solid white;
white-space: nowrap;
}
#Forecast ul li a:hover {
background-color: fuchsia;
}
#Forecast ul li {
display: inline;
/*width: 6em;*/
white-space: nowrap;
}
.border {
border: 1px solid #00ced1;
}

I've already added the white-space: nowrap; 我已经添加了white-space: nowrap; attribute to my elements and to the code itself: 我的元素和代码本身的属性:

<asp:Panel ID="pForecast" ScrollBars="Horizontal" runat="server">
                                <div id="Forecast" class="nowrap">
                                    <ul class="nowrap">
                                        <li class="nowrap"><a>current</a></li>
                                        <li class="nowrap"><a>1h later</a></li>
                                        <li class="nowrap"><a>2h later</a></li>
                                        <li class="nowrap"><a>tomorrow</a></li>
                                        <li class="nowrap"><a>tomorrow and later</a></li>
                                        <li class="nowrap"><a>even later</a></li>
                                    </ul>
                                </div>
                            </asp:Panel>

The markup for class="nowrap" : class="nowrap"的标记:

.nowrap {
white-space: nowrap;
}

When I run the code it looks like this: 当我运行代码时,它看起来像这样: 菜单分成更多行

I'm also using the bootsrap framework and quite a lot other styles. 我还在使用bootsrap框架和许多其他样式。 Is it possible to reset them for my div Forecast and only use my defined style? 是否可以为我的div Forecast重置它们并仅使用我定义的样式?

Thanks for any help! 谢谢你的帮助!

I use Rails to develop my website with Bootstrap and I encountered a similar problem where I needed to overwrite some of the styles that Bootstrap originally gave me. 我使用Rails通过Bootstrap开发网站,但遇到类似的问题,需要覆盖Bootstrap最初给我的某些样式。 To do that, I created a bootstrap_and_customization.css.scss within my assets/stylesheet folder and wrote there my own css code. 为此,我在assets/stylesheet文件夹中创建了bootstrap_and_customization.css.scss ,并在其中编写了自己的css代码。

Example

@import 'bootstrap';
@import url(http://fonts.googleapis.com/css?family=Lato:400,700);

$body-bg:                                                   #ecf0f1;
$font-family-sans-serif:                'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif;
$navbar-height:                                        45px;
$navbar-default-bg:                          white;
$navbar-default-brand-color:      #c0392b;
$brand-primary:                                    #c0392b;
$jumbotron-bg:                                         white;
$link-color: #e74c3c;


.center {
     text-align: center;
}

.navbar-brand {
     font-weight: bold;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM