【问题标题】:Using Scrollpane in bootstrap and override CSS在引导程序中使用 Scrollpane 并覆盖 CSS
【发布时间】:2014-07-13 13:09:24
【问题描述】:

我想使用滚动窗格水平滚动到预测。

我已经更新了我的文件,并将其以 bootstrap_and_customization.css 的名称保存在我的 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;
}

我已经将white-space: nowrap; 属性添加到我的元素和代码本身:

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

class="nowrap" 的标记:

.nowrap {
white-space: nowrap;
}

当我运行代码时,它看起来像这样:

我也在使用 bootsrap 框架和很多其他样式。是否可以为我的 div Forecast 重置它们并且只使用我定义的样式?

感谢您的帮助!

【问题讨论】:

    标签: html css asp.net twitter-bootstrap scrollpane


    【解决方案1】:

    我使用 Rails 通过 Bootstrap 开发我的网站,我遇到了类似的问题,我需要覆盖 Bootstrap 最初给我的一些样式。为此,我在assets/stylesheet 文件夹中创建了一个bootstrap_and_customization.css.scss,并在其中编写了我自己的css 代码。

    示例

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

    【讨论】:

    • 当我创建文件并将其链接到我的页面时,它说找不到文件 (404)。当我将其重命名为 .css 时,它可以工作但没有任何改变,元素仍然不在滚动窗格中
    • 好的,您能否编辑您的帖子并添加您创建的新文件以及链接.css 文件的页面。
    • 完成 @Cyzanfar 我在本地保存了引导文件,有区别吗?
    • 应该没有什么不同。你还有同样的问题吗?
    • 是的@Cyzanfar 目前看起来像这样screenshot (picture)。这些值填充在后面的代码中,但它在站点中中断(来自 iPhone 的屏幕截图)。 (抱歉,这是一个德语应用程序,所以值是德语)。
    猜你喜欢
    • 1970-01-01
    • 2014-05-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-15
    • 2016-12-16
    相关资源
    最近更新 更多