CSS样式未在网页中应用(源自母版页) [英] css style not applied in webpage(derived from master page)

查看:69
本文介绍了CSS样式未在网页中应用(源自母版页)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai朋友
我有一个从母版页派生的网页.在该网页中,我放置了asp.net菜单控件.如何将外部css文件用于此菜单控件.我正在将css文件分配给cssclass属性中的菜单控件.但是它不能正常工作,如何将外部CSS文件用于派生的网页.请帮助我.
谢谢

Hai friends
i have web page which is derived from the master page.In that web page i placed asp.net menu control.how can i use external css file to this menu control .I am assigning css file to the menu control in the cssclass property.but it doesnt work fine and how can use external css file to the derived web page.please help me.
thank you

推荐答案

在您的.aspx页的head标签中使用此
use this
<link rel="Stylesheet" type="text/css" href="<PATH of the css file>" />


< link rel ="stylesheet" type ="text/css" href =〜/content.css"/>但还是不行
听起来是相对路径问题.有时,在部署之后,无法正确形成被引用为图像,样式表等来源的路径.这会导致在所引用的位置找不到文件,因为未下载图像或未应用样式表.
您需要确保路径正确,以便找到并使用该文件.

我建议您使用此技巧并在设置文件源之前正确解析路径:
<link rel="stylesheet" type="text/css" href="~/content.css" /> but still it doesnt work
Sounds like it is relative path issue. At times, after deployment the path referenced as a source for images, stylesheets, etc is not correctly formed. This leads to no file found at the location referred because of which images don''t download or style-sheets does not get applied.
You would need to make sure that the path is correct such that file is found and used.

I would suggest you to use this Tip and resolve the path correctly before setting the source of the file: Resolving Paths in a Multi-Folder WebSite[^]


这篇关于CSS样式未在网页中应用(源自母版页)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆