【问题标题】:Div beside fixed div固定 div 旁边的 div
【发布时间】:2014-11-23 15:53:00
【问题描述】:

遇到了一个小问题。 如何让 DIV2 出现在以下 jsfiddle 中的“rcontainer”旁边?

目前,以下代码出现在显示为 DIV2 的 rcontainer 下

http://jsfiddle.net/ce7st2ms/

<body>
<div id="rcontainer">
    <div id="accinfo" style="height:50px; overflow:hidden;">
        <span id="inneraccinfo">
            xxxx <br />
            xxxx
        </span>
    </div>
</div>
<div>div2 here</div>
</body>

body {
padding:0px;
margin:0px;
border:0px;
}
#rcontainer {
min-height: 1000px;
min-width: 12.54%;
background-color:grey;
margin:0px;
width: 100px;
}
#inneraccinfo {
font-family:my_fat_font;
color: white;
display: table-cell;
vertical-align: middle;
padding-left: 10px;
}
#accinfo {
position: fixed;
left: 10px;
top: 122px;
display: table;
}

【问题讨论】:

  • 您是否尝试将 float:left; 添加到您的#rcontainer 中?

标签: html css appearance


【解决方案1】:

使用 float: left 在两个 div 上。

JSFiddle

CSS:

#rcontainer {
    min-height: 1000px;
    min-width: 12.54%;
    background-color:grey;
    margin:0px;
    width: 100px;
    float: left;
}

.div2 {
    float: left;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-11
    • 1970-01-01
    • 1970-01-01
    • 2018-10-02
    • 1970-01-01
    相关资源
    最近更新 更多