应用CSS在Asp.NET内容页 [英] Apply CSS to Content Page in Asp.NET

查看:82
本文介绍了应用CSS在Asp.NET内容页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,当我们使用主/内容页面风格,我们应用CSS来掌握页,因此母版页的每一页孩子可以使用的风格,但我不想这样,我想我要应用CSS内容页而不是直接母版页。我应该在哪里把

Normally when we are using Master/Content style pages, we apply the css to Master page so every page child of the master page can use the style but I don't want this,I want I wanna apply css to content page directly instead of master page. Where should I put

<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />

这是参考code?

提前感谢的方式。

推荐答案

通常我把一个内容占位符在母版页的head部分。这样任何内容页面可以额外的CSS / JS /等引用添加到页面的头部。

Normally I put a content placeholder in the head section of the master page. That way any content page can add extra css/js/etc references to the head of the page.

在你的母版页把下面的

<head>
  ... title, meta tags, js and css links ...
  <asp:contentPlaceholder id="head" runat="server" />
</head>

然后在你的页面,您可以使用此包括头部多余的元素

Then in your pages you can include extra elements in the head using this

<asp:content contentplaceholderid="head" runat="server">
 <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
</asp:content>

这篇关于应用CSS在Asp.NET内容页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆