【问题标题】:Changing css file in a web application在 Web 应用程序中更改 css 文件
【发布时间】:2013-06-17 08:39:10
【问题描述】:

我有一个网络应用程序,我必须在其中为此部分指定一个新的 css 文件:

<section id="loginForm" >
<h2>Connecter à notre application</h2>
@using (Html.BeginForm(new { ReturnUrl = ViewBag.ReturnUrl })) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Formulaire de connexion</legend>
        <ol>
            <li>
                @Html.Label("Name")
                @Html.TextBox("Name")

            </li>
            <li>
                @Html.Label("Password")
                @Html.Password("Password")

            </li>

        </ol>
        <input type="submit" value="Se connecter" />
    </fieldset>

}
</section>

例如,孔视图与 css 文件 X 相关联,我想只为本节关联另一个 Y css 文件。

我该怎么做?

【问题讨论】:

    标签: html css forms razor


    【解决方案1】:

    Scoped CSS 即将推出,但支持还不是很好。在此处阅读更多信息:http://css-tricks.com/saving-the-day-with-scoped-css/http://html5doctor.com/the-scoped-attribute/#link

    同时,另一种方法是在Y css 文件中的所有选择器前加上#loginForm。使用像 SASS 或 LESS 这样的预处理器,这很容易(将文件内容包装一次),但在纯 CSS 中变得非常乏味。

    【讨论】:

      猜你喜欢
      • 2011-04-11
      • 2015-12-02
      • 2021-12-22
      • 2011-01-05
      • 1970-01-01
      • 2010-11-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多