如何创建网格位置元素,如在这个图像CSS [英] How to create grid position elements like in this image css

查看:108
本文介绍了如何创建网格位置元素,如在这个图像CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在此图片中创建网格位置元素。我是尝试构建网格位置与我的div元素喜欢在这张照片,但我不能这样做。我试着操作vertical-align(我没有找到解决方案)和位置:绝对(不工作好太)。你能帮我吗?

How to create grid position elements like in this image. I was try build grid positions with my div elements like in this photo, but i can't do it. I was try operate with vertical-align(i am did not find solution) and with position: absolute(not work good too). Could you help me guys?

谢谢!

推荐答案

和代码(尽可能最小):

and the code (as minimal as possible):

<head>
<title></title>
<style>
    div.main
    {
        clear: both;
    }

        div.main > div.column
        {
            position: relative;
            width: 100px;
            min-height: 500px;
            float: left;
            margin:5px;
        }

            div.main > div.column > .box
            {
                background-color: black;
                min-height: 150px;
                margin:2px;
            }

                div.main > div.column > .short.box
                {
                    min-height: 100px;
                }

                div.main > div.column > .long.box
                {
                    min-height: 200px;
                }
</style>
</head>
<body>
<div class="main">
    <div class="column">
        <div class="box"></div>
        <div class="long box"></div>
        <div class="box"></div>
    </div>
    <div class="column">
        <div class="long box"></div>
        <div class="long box"></div>
    </div>
    <div class="column">
        <div class="short box"></div>
        <div class="box"></div>
        <div class="short box"></div>
        <div class="box"></div>
    </div>
</div>


这篇关于如何创建网格位置元素,如在这个图像CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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