带有服务器端代码的 CSS 样式 - 经典 ASP
我正在开发一个非常旧的应用程序,样式表中混合了服务器代码。
例如:
.curCTRL { position:absolute; border:0px; background-color:<%=obj.htmlcolorconvert(obj.maskcolor) %>; <%if session("ISFF") then%>padding-right:1px;<%end if%> z-index:50; font-family: ms sans serif; font-size: 8pt;}
有很多行都是这样的。我知道在过去你可以这样做,而且我想这并没有让人皱眉……我认为今天的样式标准有点严格,因为我不再看到太多这样的样式表了。然而,这个应用程序允许用户拥有无限的颜色和字体(根据他们的喜好)。所以对COM对象的调用是必要的。
所以我的问题是我应该坚持这种格式还是有办法可以清理它并使这个样式表成为真正的 .css 文件而不是经典 .asp 文件中的样式表?
欢迎任何和所有建议。
如果答案是暂时保留...那么好吧,我同意这个建议。然而,当我们更新到更现代的工具集(即 ASP.Net)时,我们如何设置它以便不同的用户拥有自定义的颜色和字体?
服务器控制是最好的选择吗?
I have a very old application that I'm working on and the style sheet has server code mixed in it.
For example:
.curCTRL { position:absolute; border:0px; background-color:<%=obj.htmlcolorconvert(obj.maskcolor) %>; <%if session("ISFF") then%>padding-right:1px;<%end if%> z-index:50; font-family: ms sans serif; font-size: 8pt;}
There are many lines just like this. I know that back in the day you could do this and I guess it wasn't frowned upon... I think style standards today are little tighter as I don't see too many style sheets like this anymore. However, this application allows users to have unlimited colors and fonts (to their liking). So the call to the COM object is necessary.
So my question is should I just stick with this format or is there a way I can clean it up and make this style sheet a true .css file rather than a style sheet inside a classic .asp file?
Any and all suggestions welcomed.
If the answer is to leave it for now... Then fine, I'm OK with that suggestion. However, when we update to a more modern tool set (i.e. ASP.Net), how would we set it up so that different users have custom colors and fonts?
Would server controls be the best bet?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以把它留下,除非它引起了实际的问题。
否则,“现代”解决方案是使用 CSS 预处理器,例如 LESS,特别是 变量功能。
这部分让我担心:
这看起来很可疑,就像它只为 Firefox 添加额外的
padding-right
,这似乎有点奇怪。如果确实必须这样做,那么使用这个会更好。
You could just leave it, unless it's causing an actual problem.
Otherwise, a "modern" solution would be to use a CSS preprocessor such as LESS, particularly the variables feature.
This part worries me:
That looks suspiciously like it's adding extra
padding-right
for only Firefox, which seems a bit of an odd thing to do.If that really has to be done, using this would be better.
我建议留下它。如果应用程序运行良好,那么您应该没有问题。所涉及的工作量太大,但成果却很少。
I would suggest leaving it. If the application is working fine then you should have no problem. The work involved is too much for very little outcome.