Hi,I use ASP.NET 2.0 and I created a stylesheet, but I don''t know how to makeit visible to a web form "MyWebPage.aspx" that uses the master page. I put areference to the css in the .master but it''s not visible to the newlycreated page. MyWebPage.aspx doesn''t have a<head><link rel="stylesheet" type="text/css" href="mystyle.css" /></head>structure.Thanks 解决方案 MyWebPage starts with something like:<%@ Page language="c#" Inherits="MyWebPage" CodeFile="MyWebPage.aspx.cs"MasterPageFile="Master.master" Title="This is my page"%><asp:Content ID="Content1" runat="Server"but there is no <htmlstructure.Should the code in master page which includes the reference :<link rel="stylesheet" type="text/css" href="mystyle.css" />be sufficient for MyWebPage to see the css document?Dan Aldean wrote:Hi,I use ASP.NET 2.0 and I created a stylesheet, but I don''t know how to makeit visible to a web form "MyWebPage.aspx" that uses the master page. I put areference to the css in the .master but it''s not visible to the newlycreated page. MyWebPage.aspx doesn''t have a<head><link rel="stylesheet" type="text/css" href="mystyle.css" /></head>structure.Use this, instead:<style type="text/css" media="all">@import "mystyle.css";</style>Afterwards, verify the rendered HTML to make certain that the path andeverything are what you want. You don''t have to do anything fancy tomake CSS work in a master page.--Seanwebsite: http://senfo.blogspot.comhey DanI am using css in my masterpages in the format you have below and they workjust fine -- but then I am not using those style sheets on asp controls --or atleast I haven''t tried yet -- as I am new to aspNet -- tho I think it isdoable.I''m just guessing here, but maybe it''s yer doc type declaration that iscausing the problem or your html tag if you have xlmns attribute.hey"Dan Aldean" <do*******@rogers.comwrote in messagenews:%2****************@TK2MSFTNGP04.phx.gbl...Hi,I use ASP.NET 2.0 and I created a stylesheet, but I don''t know how to makeit visible to a web form "MyWebPage.aspx" that uses the master page. I puta reference to the css in the .master but it''s not visible to the newlycreated page. MyWebPage.aspx doesn''t have a<head><link rel="stylesheet" type="text/css" href="mystyle.css" /></head>structure.Thanks 这篇关于CSS - 如何在网页中引用CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-17 13:06
查看更多