CSS @import最佳实践 [英] CSS @import Best Practices

查看:125
本文介绍了CSS @import最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在征求关于处理@ import的最佳方法的意见,或者一起避免它们。

I'm soliciting opinions about what is the best way to handle @import's or to avoid them all together.

使用DNN我发现了皮肤化,模块的所有各种重写元素的CSS可能非常混乱。将所有CSS转储到单个文件中可能很难处理,我很想知道将它们分开并将它们导入skin.css顶部是否更好。还有效率的问题,如果这是或不是一个很好的权衡。

Working with DNN I'm finding that, while skinning, the CSS for all the various overriding elements for modules and such can be very messy. Dumping all of the CSS into a single file can be arduous to work with and I am wonder if it is better to separate these and import them at the top of the skin.css. There is the question of efficiency as well and if this is or isn't a good trade off.

我不是CSS专业人士,但我想我可能知道答案,但无论如何都要问。反正有没有像.cs文件一样引用各种CSS文件? skin.Events.someElement?那不是很好吗? ; - )

I'm not a CSS pro but I think I may know the answer to this but will ask anyway. Is there anyway to reference various CSS files the same way as, say, .cs files? skin.Events.someElement ? Wouldn't that be nice? ;-)

谢谢。

推荐答案

纯粹的经验:

工作时你可以保持一切分开(reset.css,forms.css,main.css等),如果你发现很难处理单个文件 - 我不要那么做..

While working you can keep everything separated (reset.css, forms.css, main.css, etc.) if you find it hard to work with one single file - I don't do even that..

投入生产时 - 将所有内容保存在一个文件中 - 无需导入 - 1个服务器请求 - 最小化您的css。

When putting on production - keep everything in one file - no imports - 1 server request - minimize your css.

如果你想保持你的main.css黑客免费/通过验证,异常是一个额外的ie.css(我也不这样做,因为没有一个我的客户关心验证 - 人们希望它工作,徽章不是趋势:) - 所以我只是通过我的main.css(#,_等)使用黑客攻击)

Exception is an additional ie.css if you want to keep your main.css hack free/pass validation (I also don't do this since not a single of my clients cared about validation - people want it to work, badges are not a trend :) - so i just use hacks trough my main.css (#, _, etc.))

这篇关于CSS @import最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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