【问题标题】:How to apply one of three different CSS files on the same webpage based on selection of a link in MasterPage?如何根据 MasterPage 中的链接选择在同一网页上应用三个不同的 CSS 文件之一?
【发布时间】:2018-12-31 13:44:37
【问题描述】:

我有一个包含 3 个链接的母版页。

<a id="REDColor" href="WebForm1.aspx?name=Red">Red</a>
   <a id="GREEN" href="WebForm1.aspx">Green</a>
   <a id="BLUE" href="WebForm1.aspx">Blue</a>

所有这些链接都指向同一个 webform1.aspx。

我有三个具有不同背景颜色的 Css 文件;

RED.css

body {
    background-color:red;}

绿色.CSS

body {
        background-color:green;}

BLUE.CSS

    body {
 background-color:blue;}

我应该如何将这些 CSS 文件链接到母版页中的各个链接,以便将适当的 Css 文件应用于 Webform.aspx?

【问题讨论】:

    标签: html css asp.net visual-studio


    【解决方案1】:
    <link rel="stylesheet" type="text/css" href="<%= name %>.css">
    

    您可以尝试通过像这样在 WebForm1.aspx 中使用变量来包含 css 文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-05-07
      • 2020-06-19
      • 2016-10-30
      • 1970-01-01
      • 2015-02-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多