为RUNAT ="服务器"要求具有由ASP.NET构建CSS样式HTML标签? [英] Is runat="server" required for HTML tags which have CSS style built by ASP.NET?

查看:154
本文介绍了为RUNAT ="服务器"要求具有由ASP.NET构建CSS样式HTML标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到这个div标签谁在使用一些像这样的方法在CSS背景图片的被设置。

I got this div tag who's background image's being set in the CSS using some method like this..

内联CSS: -

.id0, .mySprite:hover div
    {
        background-image: url(<%=GetImage()%>);
        background-repeat: no-repeat;
        width: 728px;
        height: 243px;

    }

HTML: -

HTML:-

<div class="id0"></div>

现在,我需要重新设置 =服务器在这个div标签或不?怎么把它不给任何错误,但不知道可能是我需要怎么把图片的路径的是从code牵强的背后...图像不是在<一出现href=\"http://stackoverflow.com/questions/3975148/image-wont-render-on-my-aspx-page-after-adding-master-page-if-not-changed-id-w\">this用户控件。

Now do I need to set runat="server" in this div tag or not? Coz it's not giving no error but was wondering may be I need to coz the image's path's being fetched from code behind...the image's not appearing in this user control.

推荐答案

好了,


  • 是不需要的的Runat =服务器的说法。 CSS的加载/反正在客户端上有关(在brwoser)。

  • 对不起,哥们,但.css文件不被ASP.NET评估 - 所以基本上,在URL,浏览器得到的是&LT;%=的getImage()%GT; ,这显然浏览器不能做任何事情。

  • The "Runat=Server" is not needed at all. The CSS is loaded/associated on the client (in the brwoser) anyway.
  • Sorry, dude, but .CSS files are not evaluated by ASP.NET - so basically, the "url" that the browser gets is <%=GetImage()%>, which obviously the browser can not do anything with.

结果:不工作。的可以的无法工作。

Result: Does not work. Can not work.

这篇关于为RUNAT =&QUOT;服务器&QUOT;要求具有由ASP.NET构建CSS样式HTML标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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