开发者

CSS Style with server side code - Classic ASP

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 sug开发者_如何学Pythongestions 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?


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:

<%if session("ISFF") then%>padding-right:1px;<%end if%>

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜