ASP.NET MVC 中链接样式失败的问题

发布于 2024-08-14 12:27:15 字数 1276 浏览 7 评论 0原文

我有一个 ASP.NET MVC 应用程序,它有一个 jQuery Treeview 和一个其中的 jQuery Splitter 。顶部有一个标题。下面,分割器用于将空间分成两个div。左侧 div 包含 treeview,右侧 div 包含内容。

我有一个专门用于内容区域的样式表;所有样式都以 #Content 为前缀,包含内容的 div 为 id="Content"。在该样式表中,我对 链接进行了样式设置,以便除非您将鼠标悬停在它们上方,否则它们不会带有下划线。

通常,我会在内容区域中放置一个表格来显示一些网格样式的数据。网格内有一列用于显示详细信息的链接。

问题就在这里。内容区域中的大多数链接都可以正常工作(当您将鼠标悬停在它们上方时,它们会带有下划线),但该列中有一两个链接未达到 a:link 样式;它们将在首次显示时带有下划线,并且无论它们是否悬停在其上方,都将保持下划线。

仅当页面从 ASP.NET MVC 应用程序呈现时才会发生这种情况。我正在使用 Visual Studio (Cassini) 中的开发 Web 服务器进行测试。如果我在浏览器中查看/源代码,将页面保存在桌面上,并修复 jQuery 脚本和样式表的链接,然后通过单击如此保存的页面在浏览器中查看页面,则不会出现问题。

我已尝试过 Internet Explorer 7 和最新版本的 Firefox,链接以完全相同的方式失败,但仅在运行实际应用程序时发生。除了 #Content div 中的 之外,所有样式都有效。

以前有人见过这种随机链接样式失败的情况吗?我不知所措。我不明白为什么如果我将其从浏览器中保存并再次打开,该页面会像广告那样工作,但无论浏览器如何,它都无法在应用程序中工作。

I have an ASP.NET MVC application that has a jQuery Treeview and a jQuery Splitter in it. There is a header at the top. Below that, the splitter is used to separate the space into two divs. The left div contains the treeview, and the right div contains the content.

I have a stylesheet just for the content area; all of the styling is prefixed with #Content, and the div that contains the content is id="Content". Within that stylesheet, I have styled the <a> links so that they're not underlined unless you hover over them.

Typically I put a table in the content area to display some grid-style data. Within the grid is a column of links to display detail.

Here is the problem. Most of the links in the content area will work properly (they will underline when you hover over them), but there are one or two links in the column that are failing their a:link style; they will be underlined on first display, and stay underlined whether they are hovered over or not.

This only happens when the page is rendered out of the ASP.NET MVC application. I am using the development web server in Visual Studio (Cassini) for testing. If I View/Source in the browser, save the page on my desktop, and fixup the links to the jQuery scripts and the style sheets, and view the page in the browser by clicking on the thusly saved page, the problem does not occur.

I have tried both Internet Explorer 7 and the latest version of Firefox, and the links fail in exactly the same way, but only when running the actual application. All of the styling works, except for <a:link> in the #Content div.

Has anyone seen these kind of random link styling failures before? I am at a loss. I don't understand why the page would work as advertised if I save it out of the browser and open it again, but it will not work from the application, regardless of browser.

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

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

发布评论

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

评论(2

音栖息无 2024-08-21 12:27:15

通过将 a:visited { text-decoration:none } 添加到内容区域样式表并清除浏览器缓存来修复。

Fixed by adding a:visited { text-decoration:none } to the content area stylesheet, and clearing the browser cache.

终陌 2024-08-21 12:27:15

jQuery UI 是否有任何由 jQuery 函数本身生成的样式 css 文件或内联 css。有问题的链接可能有不同的级联签名,这就是您的 css 不适用的原因。使用 Firebug 检查 CSS 选择器。

Does the jQuery UI have any styling css files or inline css generated by the jQuery functions itself. It's likely that the links with problems have a different cascade signature and that is why your css is not applying. Use Firebug to check the css selectors.

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