我怎样才能让两个<div>更接近?</div>

时间:2014-04-02 21:48:52

标签: html css

enter image description here参见图片 - 我想带上&#39;左边&#39;并且&#39;对&#39;更靠近在一起,所以它们保持尽可能接近标题,上面是蓝色。

这是我左右两边的CSS ...非常感谢!

.left {
    float: left;
    position: relative;
    background-color: #DDFF00;
    margin-top: 40px;
    margin-bottom: 10px;
    height: 500px;
    width: 10%;
}

.right {
    float: right;
    position: relative;
    background-color: #FFE6E6;
    margin-top: 40px;
    margin-bottom: 10px;
    margin-left: 10px;
    height: 500px;
    width: 88%;
}

1 个答案:

答案 0 :(得分:1)

.left {
    float: left;
    position: relative;
    background-color: #DDFF00;
    margin-top: 40px;
    margin-bottom: 10px;
    height: 500px;
    width: 10%;
}

.right {
    float: right; /*<-change to left */
    position: relative;
    background-color: #FFE6E6;
    margin-top: 40px;
    margin-bottom: 10px;
    margin-left: 10px; /*<-and play with that too*/
    height: 500px;
    width: 88%; /*<-or increase that, without any changes above */
}