Issues with masterpages/views/css
So my masterpage looks like this:
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link type="text/css" href="~/Content/Main.css" rel="stylesheet" />
<link type="text/css" href="~/Content/ui-lightness/jquery-ui-1.8.10.custom.css" rel="stylesheet" />
<script type="text/javascript" src="~/Scripts/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="~/Scripts/jquery-ui-1.8.10.custom.min.js"></script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
</head>
<body>
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
</body>
</html>
My view looks like this:
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/JQuery.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="Main" ContentPlaceHolderID="MainContent" Runat="Server">
<div class="header">Welco开发者_JAVA百科me!</div>
</asp:Content>
And the CSS file looks like this:
div.header
{
text-align: center;
}
However I'm not seeing center aligned text. What am I doing wrong? Also, will I need to make whatever changes to the JQuery .css files as well? Basically what I'm aiming for here is a single master page that I can use to hold all .css and javascript code so I don't have to reference it everywhere else.
Thanks!
Figured it out. Needed to declare the all the <script>
stuff in the header of the masterpage.
精彩评论