【问题标题】:How can I use bootstrap in css file?如何在 css 文件中使用引导程序?
【发布时间】:2016-03-10 10:28:01
【问题描述】:

我想在我的 asp.net 4 项目中使用 bootsrap。

我使用 nuget 在 Visual Studio 中安装了引导程序:

我有全局 css 文件:

    /*Global styles*/
body, form
{
    direction: rtl;
    font-family: Arial;
    font-size: 16px;
    color: #333333;
    margin: 0px;
    padding: 0px;
    background-position: bottom;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-color: #f8f8f8;
}
input[Type=text], input[Type=password], input[Type=button], input[Type=submit], input[Type=reset], input[Type=file], select, textarea
{
    margin: .2em .05em;
    border: 1px solid #333333;
    color: #333333;
}
input[Type=text], input[Type=password], input[Type=file], select, textarea
{
    max-width: 225px;
    width: 98%;
}
input[Type=text]:disabled, input[Type=password]:disabled, input[Type=file]:disabled, select:disabled, textarea:disabled
{
    background-color: #E6F6FA;
}
input[Type=button], input[Type=submit], input[Type=reset]
{
    background-color: #EEEEEE;
    cursor: pointer;
}
input[Type=button]:hover, input[Type=submit]:hover, input[Type=reset]:hover
{
    background-color: #DCDCDC;
}

我需要使用引导程序定义按钮和其他元素的样式,我想在全局 css 文件中定义它。

所以我的问题是如何在 css 文件中使用引导程序?

【问题讨论】:

    标签: css asp.net twitter-bootstrap


    【解决方案1】:

    您可以像 stara_wiedzma 所说的那样导入 CSS 文件。 但是,您不能使用 CSS 全局导入 input[Type=button], input[Type=submit], input[Type=reset] 的引导程序的 .btn 类

    我认为您正在寻找 LESS of SASS 之类的东西。 使用 LESS 和 SASS,您可以执行以下操作:

    input[type=button]{
        .btn;
        .btn-success;
    
        // your own styles...
    }
    

    Google:一些设置和示例的“无引导工作流程”。

    【讨论】:

    • LESS 或 SASS 是否让我选择将引导样式导入 css 页面?
    • 是的!您可以在自己的元素上继承引导程序的类。我给出的示例将使所有按钮看起来像引导程序的成功按钮。
    • 你能举一些例子吗?或者在google中写参考例子?
    • 我认为这个:scotch.io/tutorials/getting-started-with-less 会解释很多
    【解决方案2】:

    @import url("//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css");

    【讨论】:

    • 在 ccs 文件中在哪里写?如何将其添加到按钮样式定义中?
    猜你喜欢
    • 2015-02-27
    • 2013-06-01
    • 1970-01-01
    • 2014-12-14
    • 2016-07-22
    • 1970-01-01
    • 2016-11-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多