如何将其应用于 ASP.net 中的 contentPlaceHolder?

发布于 2024-08-03 05:18:25 字数 79 浏览 10 评论 0原文

#control {
position: absolute;
right: 0px;
top: 0px;
}
#control {
position: absolute;
right: 0px;
top: 0px;
}

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

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

发布评论

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

评论(2

絕版丫頭 2024-08-10 05:18:25

你不能。这是因为 ContentPlaceHolder 不会呈现到页面上的任何内容。

但是,您可以将 div 包裹在其周围,然后将样式应用于它:

<div class="control">
    <asp:ContentPlaceHolder runat="server" ID="Content" />
</div>

You cannot. That's because ContentPlaceHolder does not render to anything on a page.

You can however wrap a div around it and then apply the styles to it:

<div class="control">
    <asp:ContentPlaceHolder runat="server" ID="Content" />
</div>
救星 2024-08-10 05:18:25

如果您的目的是渲染 div 元素,我建议您改用面板控件。如果您愿意,您仍然可以添加/删除子控件(与 ContentPlaceHolder 一样)。

// In your CSS
.control { position: absolute 0px 0px; }

// In your form
<asp:Panel ID="pnl" Runat="server" CssClass="control" />

If your intension is to render out a div-element I would suggest that you used the Panel-control instead. You can still add/remove child Controls if you'd like (as with the ContentPlaceHolder).

// In your CSS
.control { position: absolute 0px 0px; }

// In your form
<asp:Panel ID="pnl" Runat="server" CssClass="control" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文