包含 Modernizr JS 库使得 asp.net 站点的整个变得更加清晰。内容不渲染

发布于 2024-11-29 23:57:35 字数 2790 浏览 2 评论 0原文

我正在利用 CSS3 在我的网络应用程序中创建圆形边框。我创建了一个空白的 ASP.NET 应用程序,有一个母版页和一个内容页。内容页面按预期引用母版页,并且母版页几乎是标准的开箱即用母版页。 当我在没有modernizr的情况下在本地运行页面时,在所有浏览器中看起来都很好,但是当我在母版页的标签中包含modernizr .js文件引用时,我得到一个空白的html页面,其背景颜色是我在css文件中设置的。标签之间的所有内容都不会被渲染。

这是我使用 border-radius 属性的 css 片段。

#container {background:#444;width:860px;border:1px solid #FFF;border-radius: 30px 0px 30px 30px; margin:20px auto;padding:20px;}

这是我的母版页(您会注意到modernizr被注释掉了)

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="Site.Site" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Name</title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<link href='http://fonts.googleapis.com/css?family=Tangerine' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="style/style.css" media="all" />
<!-- <script src="script/modernizr.custom.51561.js" type="text/javascript" /> -->
</head>
<body>
<div id="container">
    <div id="header">
        <h1>Name</h1>
        <p> text
            </p>
    </div>
    <div id="nav">
        <ul>
            <li><a href="">Nav Link</a></li>
            <li><a href="">Nav Link</a></li>
            <li><a href="">Nav Link</a></li>
            <li><a href="">Nav Link</a></li>
        </ul>
    </div>
    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
    </asp:ContentPlaceHolder>

    <div id="footer">
       Links
    </div>
</div>
</body>
</html>

这是我的内容页面

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="Site._default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <form id="form1" runat="server">
        <div id="content">
            <div class="column">
            </div>
            <div class="column">
            </div>
            <div class="column">
            </div>
        </div>
    </form>
</asp:Content>

希望这不是代码过度杀伤...我已经尝试了来自modernizr的多个.js文件,开发版本,自定义版本,生产版本。 ..似乎都产生相同的结果。也许我没有正确设置它,我的印象是,modernizr 只是一个包含的库,您可以引用它,然后忘记它,它几乎会处理其余的事情。也许还有更多的事情要做。

I am utilizing CSS3 to create rounded borders in my web app. I have created a blank asp.net application, I have a master page and one content page. The content page references the masterpage as expected and the masterpage is pretty much a standard out of the box masterpage.
When I run page locally without modernizr things look fine in all browsers, however when I include the modernizr .js file reference within the masterpage's tags I get a blank html page with the background color that I have setup in my css file. Everything between the tags is not being rendered.

here is a css snippet that i have that uses the border-radius property.

#container {background:#444;width:860px;border:1px solid #FFF;border-radius: 30px 0px 30px 30px; margin:20px auto;padding:20px;}

here is my masterpage (you'll notice modernizr commented out)

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="Site.Site" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Name</title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<link href='http://fonts.googleapis.com/css?family=Tangerine' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="style/style.css" media="all" />
<!-- <script src="script/modernizr.custom.51561.js" type="text/javascript" /> -->
</head>
<body>
<div id="container">
    <div id="header">
        <h1>Name</h1>
        <p> text
            </p>
    </div>
    <div id="nav">
        <ul>
            <li><a href="">Nav Link</a></li>
            <li><a href="">Nav Link</a></li>
            <li><a href="">Nav Link</a></li>
            <li><a href="">Nav Link</a></li>
        </ul>
    </div>
    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
    </asp:ContentPlaceHolder>

    <div id="footer">
       Links
    </div>
</div>
</body>
</html>

And here is my content page

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="Site._default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <form id="form1" runat="server">
        <div id="content">
            <div class="column">
            </div>
            <div class="column">
            </div>
            <div class="column">
            </div>
        </div>
    </form>
</asp:Content>

Hopefully that is not code overkill... I have tried multiple .js files from modernizr, the dev version, a custom version, the production version... all seem to produce the same results. Perhaps I'm not setting it up properly, I was under the impression modernizr was just an included library that you reference and then forget about it and it pretty much takes care of the rest. Perhaps there's more to it than that.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无声静候 2024-12-06 23:57:35

这已损坏并且无法工作

<script src="script/modernizr.custom.51561.js" type="text/javascript" />

您需要这个:

<script src="script/modernizr.custom.51561.js" type="text/javascript"></script>

这个是一个你只会犯一次的错误。

This is broken and won't work:

<script src="script/modernizr.custom.51561.js" type="text/javascript" />

You need this:

<script src="script/modernizr.custom.51561.js" type="text/javascript"></script>

This is a mistake that you'll only make once.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文