使用 CSS 框架的优点

发布于 2024-07-25 08:06:27 字数 287 浏览 4 评论 0原文

我一直在考虑使用 CSS 框架,因为许多网页设计师都使用它。 他们说它很好,等等。但是使用像 960 Grid System 或 < a href="http://en.wikipedia.org/wiki/Blueprint_%28CSS_framework%29" rel="noreferrer">蓝图? 它会让我的生活更轻松吗? 这些框架是否考虑了邪恶的 Internet Explorer?

任何见解都会有所帮助。

I have been thinking of using a CSS framewrok as many web designers use it. They say that it is good, etc. But is there any real advantage of using a CSS framework like 960 Grid System or Blueprint? Will it make my life easier? Do these frameworks consider the devilish Internet Explorer?

Any insights will be helpful.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

雨后彩虹 2024-08-01 08:06:27

许多框架都包含 Reset-Rules,它是单个样式表 (一般是 Meyers 或其派生),平衡元素的渲染多个浏览器。 现在,如果您决定是否使用 CSS 框架,则应该使用 Reset< /a>.

我只真正使用过 960,而且我必须说我很喜欢它。 最酷的是,您的布局是使用包含数值的类名进行布局的,这意味着您可以根据需要以编程方式确定新的布局 - 简单的数学。 在许多情况下,它还可以更快地开发复杂的布局。 Nettuts 制作了960 度视频 不久前称为“A详细查看960 CSS框架。”

您需要一个框架吗? 不,他们有帮助吗? 在很多情况下。 至少,我鼓励您下载 960 并使用它,从现在开始至少开始使用重置

960 标​​记和类名称示例:

<div class="container_12">
    <div class="grid_7 prefix_1">
        <div class="grid_2 alpha">
            ...
        </div>
        <div class="grid_3">
            ...
        </div>
        <div class="grid_2 omega">
            ...
        </div>
    </div>
    <div class="grid_3 suffix_1">
        ...
    </div>
</div>

Many frameworks include Reset-Rules, which is a single stylesheet (Generally Meyers' or a derivation of it) that balances out the rendering of elements across multiple browsers. Now, if you decide to use a CSS Framework or not, you SHOULD use a Reset.

I've only really used 960, and I must say that I enjoy it. The cool thing is that your layout is laid out with classNames that contain numerical-values, meaning you could programmatically determine a new layout if you like - simple math. It also makes developing a complicated layout much faster in many cases. Nettuts did a video of 960 some time back called "A Detailed Look at the 960 CSS Framework."

Do you NEED a framework? No. Do they help? In many cases. At the very least, I would encourage you to download 960 and play with it, and from now on start using at least a Reset.

Example of 960 Markup and Class Names:

<div class="container_12">
    <div class="grid_7 prefix_1">
        <div class="grid_2 alpha">
            ...
        </div>
        <div class="grid_3">
            ...
        </div>
        <div class="grid_2 omega">
            ...
        </div>
    </div>
    <div class="grid_3 suffix_1">
        ...
    </div>
</div>
抚你发端 2024-08-01 08:06:27

最好不要将框架的概念与特定框架的类型或实例混淆。 有些人认为,由于框架(例如 960)不适合特定用例,因此您应该完全避免使用框架。 疯狂的!

框架是优秀开发人员用来完成工作的工具。 熟练的开发人员甚至可能构建自己的框架供自己使用。 抽象是每个开发人员都应该掌握的强大概念。

花点时间考虑一个好的框架的定义是很有趣的:“软件的抽象提供可以通过用户代码有选择地更改的通用功能”。 也许有人会说 CSS 实际上是一个扩展 HTML 的框架。

我玩过 960,我建议尝试一下,但现在,我倾向于使用 sass。 我认为有一个 960 端口和 sass 蓝图。

我最近在一个大型企业网站上工作,我做的第一件事就是将 CSS 中的十六进制值抽象到调色板中,以便减少 CSS 文件中的冗余。 大约一个月后,客户要求我们针对不同的市场重新命名网站,这意味着更改一些精灵并更新调色板,工作就完成了。 只花了几分钟!

但至少回答你的部分问题:是的! 使用框架有很多优点。 我什至会说,避免它们有点天真。

PS:抱歉,如果我的回答不具体,但您确实提到任何见解都会有所帮助:)

It's a good idea not to confuse the concept of a framework with a type or instance of a particular framework. Some argue that because a framework (like 960 for example) doesn't suit a certain use case, you should avoid frameworks altogether. Crazy!

A framework is a tool that good developers use to get a job done. A skilled developer might even build their own framework for their own consumption. Abstraction is a powerful concept that every developer should master.

It's interesting to take a moment to consider a good definition of a framework: "An abstraction in which software providing generic functionality can be selectively changed by user code". It could perhaps be argued that CSS is in fact, a framework extending HTML.

I have played around with 960 and I recommend giving it a go but these days, I tend to make my own set of rules (a framework) using something like sass. There is a port of 960 and blueprint into sass, I think.

I recently worked on a large enterprise website and one of the first things I did was abstracted out the hex values from the CSS into a color palette so there was less redundancy in the CSS files. A month or so later the client asked us to rebrand the site for a different market which meant changing a few sprites and updating the color palette and the job was done. It took just a few minutes!

But to answer at least part of your question: Yes! There are advantages to using a framework. I would even go as far to say that avoiding them is a little naive.

PS: sorry if my answer is not specific but you did mention any insights would be helpful :)

贪了杯 2024-08-01 08:06:27

我同意到目前为止所说的内容。 这些框架确实加快了速度。 是的,真正了解幕后发生的事情很重要,但要回答您的问题,使用 CSS 框架有哪些优势。 我对此的看法是:

通过使用框架,您不需要成为 CSS 专家来实现任何设计。 当我需要其他人来实施设计而没有专家时,这对我特别有用。

I agree with what's been said so far. Those frameworks do speed things up. Yes, it is important to really know what's going on behind the scenes, but to answer your question, what are advantages of using a CSS framework. Here's my take on that:

By using a framewok you don't need to be a CSS expert to implement any design. This has been especially useful for me when I need someone else to implement a design, and an expert is not available.

内心旳酸楚 2024-08-01 08:06:27

这取决于。 如果你正在学习 CSS 或者项目不需要很多样式,我认为你不应该使用 CSS 框架。 另外,如果你想创建一个非常独特或特定的样式,它不会对你有太大帮助。

但是,如果您对 CSS 有经验并且项目很大,那么 CSS 框架可能会帮助您节省时间和解决问题。

是的,他们考虑了 IE。

It depends. If you are learning CSS or the project doesn't require a lot of styling, I think you shouldn't use a CSS framework. Also, if you want to create a very unique or specific styling, it won't help you a lot.

However, if you are experienced with CSS and the project is large, a CSS framework may help you to save time and problems.

And yes, they consider IE.

CSS 框架确实可以通过一组预定义的类来帮助节省布局页面的时间。 我认为它们很棒,并且确实可以减少将设计转换为 html/css 所花费的时间。 我建议看一下我经常使用的一些。

heymuscle

960gs

1140 网格

希望这有帮助。

CSS frameworks can really help save time laying out your page with just a set of predefined classes. I think they are great and can really decrease the time you spend converting a design to html/css. I would recommend taking a look at a few that I use on a regular basis.

heymuscle

960gs

1140 grid

hope this helps.

心碎的声音 2024-08-01 08:06:27

一旦你习惯了它们,CSS 框架就可以大大加快跨浏览器网站的创建速度。

IE 支持因框架而异。 有些仅支持 IE8 及更高版本。 其他支持旧版 IE 直至 IE6。

几个月前,我发布了自己的 CSS 框架“Cascade Framework”。

Once you get used to them, CSS frameworks can seriously speed up the creation of crossbrowser websites.

IE support varies from framework to framework. Some support only IE8 and up. Others support old IE up to IE6.

I released my own CSS framework "Cascade Framework" a couple of months ago.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文