修改基础CSS框架的最佳做法 [英] Best practices for modifying foundation CSS framework

查看:154
本文介绍了修改基础CSS框架的最佳做法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在实现foundation.css框架,我应该更新我的自定义需求(字体颜色,背景等)的实际foundation.css或者我应该使用辅助css为我的自定义,这样当foundation.css需要更新我可以请替换它,而不会丢失我的自定义。

In implementing foundation.css framework, shall I update the actual foundation.css for my custom needs (font colors, backgrounds, etc) or shall I use a secondary css for my customization so that when foundation.css needs updating I can replace it without losing my customization.

让我知道你对这个策略的想法。这将是上面第二个选项的代码:

Let me know your thoughts on this strategy. This would be the code the second option above:

<link rel="stylesheet" href="css/foundation.css" media="screen, projection" />
<link rel="stylesheet" href="css/my-custom.css" media="screen, projection" />

谢谢

推荐答案

我认为这是一个意见请求而不是一个真正的问题。
仍然,我会说的答案是,一如既往在这些情况下,它取决于。

Well I think this is more an opinion request than a real question. Still, I'd say the answer is, as always in these cases, it depends.

你可以覆盖原来的样式与第二个css,我认为这是他们在他们的文档建议(在最后,我没有使用基金会,我认为,6个月,对不起)。它只是工作确定,你未来的升级将更容易集成,以防万一框架会得到一些。这当然是一个完美的面向未来的方法。

You can certainly override the original stylings with a second css, and I think that's what they suggested on their docs (haven't been using Foundation during the last, I think, 6 months, sorry). It will just work ok, and your future upgrades will be easier to integrate, in case the framework will get some. This is certainly a perfect future-proof approach.

性能方面,我建议直接自定义css。我的原因是:

Performance-wise I'd suggest to directly customise that very css. My reasons are:


  • 减少KB :您的css将变轻=加载更快。
  • 减少DOM绘画:浏览器不必以基本方式对元素进行样式化,然后以您的方式重新设置样式。

  • strong>较少HTTP请求:浏览器只会下载一个css,从而节省一个额外的HTTP请求(fater加载时间)

  • Less KB: Your css will be lighter = faster to load.
  • Less DOM painting: the browser won't have to style elements the Foundation way and then style them again your way.
  • Less HTTP requests: the browser will only download one css, saving one extra HTTP request (fater load time)

所以,它真的取决于你,因为你是唯一一个谁知道该网站是否需要一个框架更新。
当我使用Foundation时我从来没有需要更新,我认为已经测试了很多,所以几乎不需要更新。

So, it's really up to you, as you're the only one who knows if the website will need a framework update. I never had the need of an update when I used Foundation, and I think it's been tested quite a lot that vital updates will hardly be needed.

这篇关于修改基础CSS框架的最佳做法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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