将 960 个网格系统值放入外部文件中

发布于 2024-09-14 10:15:30 字数 594 浏览 0 评论 0原文

我正在考虑使用 Nathan Smith 的 960 网格系统 在我正在编写的 ASP.NET MVC 站点中进行布局。

我注意到 960.gs 用法的所有示例都显示 HTML,如下所示:

<div class="container_12"> 
    <div class="grid_12"> 
    </div> 
    <!-- end .grid_12 --> 
    <div class="clear"></div> 
    <div class="grid_1"> 
    </div>
    <!-- ... -->
</div>

我不太喜欢将所有这些网格值放在 HTML 本身中 - 它会造成混乱并且内容很多,这可能会变得很难管理。

是否可以以某种方式将这些容器和网格值放入外部文件,该文件基于某些标签的idclass属性应用网格值?

I'm thinking of using Nathan Smith's 960 Grid System for layout in the ASP.NET MVC site that I'm writing.

I've noticed that all examples of 960.gs usage show HTML that looks like this:

<div class="container_12"> 
    <div class="grid_12"> 
    </div> 
    <!-- end .grid_12 --> 
    <div class="clear"></div> 
    <div class="grid_1"> 
    </div>
    <!-- ... -->
</div>

I don't particularly like putting all those grid values inside the HTML itself - it creates clutter and with a lot of content, that can become hard to manage.

Is it possible to somehow put those container and grid values inside an external file that applies grid values based on the id or class attributes of certain tags?

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

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

发布评论

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

评论(1

那些过往 2024-09-21 10:15:30

你无法将这些价值观具体化。虽然可以将名称合并到文件中,以便您指定给 div 的名称是带有网格的多个 CSS 选择器(即:.sidebar、.grid_3 {...}) ,这是不切实际的,并且几乎不可能管理和维护代码。您牺牲的可读性和可维护性比您获得的语义优点更有价值。

960 网格系统的后端相当丑陋。你放弃了美好,你就获得了开发的简单性和效率。也许不同的基于列的网格系统会更好。考虑类似 Frame: http://frame.serverboy.net/ (;) 或蓝图 CSS。

希望这有帮助。

You can't externalize those values. While it would be possible to merge the names into the file such that the names that you designate to the divs are multiple CSS selectors with the grid (i.e.: .sidebar, .grid_3 {...}), this is impractical and makes it nearly impossible to manage and maintain the code. The readability and maintainability that you'd be sacrificing is much more valuable than the semantic goodness that you'd be gaining.

The 960 grid system is pretty ugly on the back end. What you give up in niceness, you gain in simplicity and efficiency of development. Perhaps a different column-based gird system would be better. Consider something like Frame: http://frame.serverboy.net/ (</shameless_plug>) or Blueprint CSS.

Hope this helps.

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