将CSS模板应用于包含内容/控件的ASP页面

时间:2014-02-08 22:23:07

标签: asp.net css

我正在帮助申请将CSS布局应用于Asp控件/内容的正确语法。

对于普通的.aspx页面,我通常会链接到标题中的CSS模板,类似于以下内容.....

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
    Inherits="Project.Default" %>

<!DOCTYPE html>
<html lang="en">
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />

<head>
  <meta charset="utf-8">
  <link rel="stylesheet" href="wp-content/themes/newtheme/css/reset.css" 
    type="text/css" media="screen">
       <%--....etc--%>
  <script>
       <%--....etc--%>
  </script>
</head>
       <%--....etc--%>
<body id="page1">
       <%--....etc--%>     
</body>

</html>

如何应用类似的CSS模板来控制基本页面结构的格式如下?

<%@ Page Title="Login" Language="C#" 
      MasterPageFile="~/themes/default/default.master" 
      AutoEventWireup="true" Inherits="login" 
      EnableViewState="false" Codebehind="login.aspx.cs" %>
<%@ Register Src="controls/login-with-captcha.ascx" 
      TagName="LoginWithCaptcha" TagPrefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
       <meta name="robots" content="NOINDEX, NOFOLLOW"/>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" 
       runat="Server">
  <uc1:LoginWithCaptcha ID="LoginWithCaptcha1" runat="server" />
</asp:Content>

1 个答案:

答案 0 :(得分:2)

将其添加到Content1Content2,但我建议Content1实际上它是主人!

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">

       <meta name="robots" content="NOINDEX, NOFOLLOW"/>

       <link type...................YOUR CLASS............>

</asp:Content>