css - Div 和 CSS : spacers the same between divs in major div? I.e 红色背景的黄色 2x3 框之间的间隔相同

标签 css html

我想要左边(蓝色的页眉/页脚,绿色的边,红色中间的东西,里面有 6 个盒子),我得到了右边,即水平的东西,代码为 here .

enter image description here

如何将黄色框设为 3x2 红色背景和绿色/蓝色边?我该如何做这个布局 here换句话说?当我稍微改变一下布局时,我通常会发现黄色东西之间的间隔符不相等——如何使间隔符相等?

最佳答案

这会让你走上正轨

<html>
<style>
        .block{
                background-color:yellow;
                height:20px;
                width:300px;
                border:20px;
                display:inline;
                float: left;
                margin:10px;
        }
        #document{
                background-color:green;
        }
        #pitches{
                background-color:red;
                margin:auto;
                overflow:auto;
                width:700px;
                height:300px;
        }
        #header, div#footer{
                background-color:blue;
                height:200px;
                margin:auto;
                overflow:auto;
                width:900px;
        }
</style>

<body>
        <div id='document'>
                <div id='header'></div>
                <div id='pitches'>
                        <div class='block'></div>
                        <div class='block'></div>
                        <div class='block'></div>
                        <div class='block'></div>
                </div>
                <div id='footer'></div>
        </div>
</body>
</html>

关于css - Div 和 CSS : spacers the same between divs in major div? I.e 红色背景的黄色 2x3 框之间的间隔相同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13519956/

相关文章:

html - 如何让 <li> 和它的 <a> child 一样高?

html - 居中面板

css - WordPress Bootstrap 。不向右流动

html - 为什么:hover on td not work?

html - 文本不环绕 float 图像。但是图像环绕着 float 的文本

javascript - 将 localStorage 中的内容附加到 div 脚本后不再起作用

html - 将一个元素向左对齐,一个向屏幕中心对齐,并垂直对齐两者 - CSS

jquery - 对于每个帖子,以及其中不同样式的每个 blockquote

css - 页眉 + map + 页脚使用 100% 高度

html - 有没有办法让 div 上永远没有滚动条?