【问题标题】:What's the best approach to this type of layout?这种布局的最佳方法是什么?
【发布时间】:2011-03-28 18:32:29
【问题描述】:

我知道我可以只使用边距和填充来完成我想要的。但是,这似乎有点……我不知道,我猜很奇怪。我只是觉得有一个更...结构化?这样做的方法?

这是我想做的:

你建议我怎么做?任何建议表示赞赏。

谢谢!

【问题讨论】:

    标签: layout html css


    【解决方案1】:

    哦,伙计,有一个我喜欢的 CSS 网格系统,它很容易实现和理解。检查一下,它叫做960 Grid System。虽然它是为 960 像素制作的,但它很容易更改。

    <div class='container_4'><!-- this will be a container that takes up four grid spots-->
        <div class='grid_1 alpha'><!-- this will start from the first column in the container and will take one spot-->
            <h2>Heading</h2>
            <li>List Item</li><!-- et cetera -->
        </div>
        <div class='grid_1'><!-- this takes up next spot and extends one col -->
            <h2>Heading</h2>
            <li>List Item</li><!-- et cetera -->
        </div>
        <div class='grid_1'><!-- this takes up next spot and extends one col -->
            <h2>Heading</h2>
            <li>List Item</li><!-- et cetera -->
            <h2>Heading</h2>
            <li>List Item</li><!-- et cetera -->
        </div>
        <div class='grid_1 omega'><!-- this takes up last spot and extends one col -->
            <h2>Heading</h2>
            <li>List Item</li><!-- et cetera -->
        </div>
    </div> <!-- end the container -->
    

    alpha 和 omega 类连续出现在第一个和最后一个网格项上。

    【讨论】:

    • 我总是使用 960px。感谢您的回答,但我一直很难理解网格系统。关于它的一些东西..只是没有沉入其中。
    • 谢谢 Sydenam,很抱歉让您感到痛苦。
    • OooOow - 现在我有点明白了,这太邪恶了......谢谢@Sydenam! :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-28
    • 1970-01-01
    • 1970-01-01
    • 2019-12-12
    • 2017-09-09
    • 1970-01-01
    • 2015-02-12
    相关资源
    最近更新 更多