在 ASPx 页面中使用自定义 WebUserControl 时 CSS 变得扭曲

发布于 2024-09-26 06:18:00 字数 278 浏览 0 评论 0原文

我有一个非常简单的从 System.Web.UI.UserControl 派生的 Web UserControl。 在设计时,用户控件在 VS2008 窗格中与所有 CSS 样式看起来都很完美。什么时候 我将此控件拖放到 aspx 页面上,应用了 CSS 样式,但某些文本被隐藏,并且 CSS 看起来扭曲了。

我已经检查了 CSS、UserControl 和 ASPx 页面的路径。全部都在 root 下处于同一级别。 aspx 页面仅在 FORM 标记中包含 UserControl。

知道出了什么问题吗?

I have a very simple Web UserControl derived from System.Web.UI.UserControl.
At Design Time the user control looks perfect in the VS2008 Pane with all CSS styles. When
I drag n drop this control on an aspx page, the CSS style gets applied but some texts get hidden and the CSS looks distorted.

I have checked the path of the CSS, UserControl and the ASPx page. All are in the same level under root. The aspx page just contains the UserControl in a FORM tag.

Any idea what is going wrong ?

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

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

发布评论

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

评论(1

濫情▎り 2024-10-03 06:18:00

找到解决方案!!!

VS2008默认添加此DOCTYPE -

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

将其更改为

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

这解决了这个问题。样式表获取
正确应用!!!

Found the solution !!!!

VS2008 adds this DOCTYPE by default -

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Change it to

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

This solves the issue. Stylesheet gets
applied properly !!!

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