开发者

CSS only working in visual studio designer

开发者 https://www.devze.com 2023-03-23 19:44 出处:网络
I\'m working on a Web Application in Visual开发者_开发技巧 Studio 2010. For some reason the CSS only works properly inside visual studio. I can see the CSS inside the design view of the page. When I v

I'm working on a Web Application in Visual开发者_开发技巧 Studio 2010. For some reason the CSS only works properly inside visual studio. I can see the CSS inside the design view of the page. When I view the page on localhost the CSS is not being applied. can anyone help me?

this is the code:

asp file:

</head>
    <body>
        <form id="form1" runat="server">
            <asp:Image ID="Image1" runat="server" ImageUrl="~/images/344704-5.jpg" CssClass="Image"/>
        </form>
    </body>
</html>

CSS file:

body
{
    background: #FFFF00;
    font: normal small Arial, Helvetica, sans-serif;
    color: #FFFFFF;
}


.Image
{
    left: 321px;
    position: relative;
    top: 2px;
    width: 282px;
    height: 187px;
}

EDIT: <link href="Styles/Site.css" type="text/css" rel="stylesheet"/>

what could be wrong?

thanks.


the problem was that I need to clear the browser cache every time that I run the ASP file. I don't know if it is how it suppose to be, but it works.


Probably you don't have access to Site.css file.

Maybe an authenticated security web form is blocking the file, try to give access to this file.


I can't see anything wrong with the code that you have posted.

My guess would be that there is something wrong with how you include the CSS in the page, but I can't know as you have omitted that part of the code.


Open the source view of your page in development mode and look at the URL to the CSS file. The path to the file on the development server is probably wrong. Double check the folder structure on the development server - you can try paths like folder/stylesheet.css or /folder/stylesheet.css etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消