Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 用内容展开框_Html_Css - Fatal编程技术网

Html 用内容展开框

Html 用内容展开框,html,css,Html,Css,很抱歉给你一个奇怪的标题,但我真的不知道如何简单地描述它 首先,我将在上面链接我的JSFIDLE 当我添加“float:left”和“float:right”时,行跳出了框,框不会随着内容变得“更大”而扩展 我的问题是,如果盒子没有设定的高度,我如何让盒子在内容之后像对待里面的内容一样展开 为了发布我的JSFIDLE,我需要添加一些代码,以便我的CSS: #profile_friends { margin-top: 15px; margin-left: -10px; background: rg

很抱歉给你一个奇怪的标题,但我真的不知道如何简单地描述它

首先,我将在上面链接我的JSFIDLE

当我添加“float:left”和“float:right”时,行跳出了框,框不会随着内容变得“更大”而扩展

我的问题是,如果盒子没有设定的高度,我如何让盒子在内容之后像对待里面的内容一样展开

为了发布我的JSFIDLE,我需要添加一些代码,以便我的CSS:

#profile_friends {
margin-top: 15px;
margin-left: -10px;
background: rgb(240,240,240);
border: 2px solid #555;
border-radius: 3px;
width: 100%;
}

.friend_left {
float: left;
width: 250px;
}

.friend_right {
float: right;
width: 250px;
}

.friend img {
width: 50px;
height: 50px;
float: left;
margin-left: 15px;
margin-right: 8px;
}

.friend ul {
list-style-type: none;
margin-top: -15px;
margin-left: 35px;
}

#profile_friends h4 {
margin: 0;
padding: 0;
text-align: center;
text-transform: uppercase;
color: rgb(110,110,110);
font-weight: bold;
height: 20px;
}

#profile_friends hr {
margin: 0;
padding: 0;
}

如果我理解正确,请使用:

#friendlist {
    overflow: auto;
}

我有这个问题,但使用了overflow:hidden;在父分区上


}

@JoshC不,不会的。如果他的边距、填充物或宽度不正确,在“溢出:自动”中,他就会知道。在《溢出:隐藏》中,他不会。因此,“overflow:auto”更具语义和恰当性,尽管我承认有些人害怕使用它,因为他们有滚动条。如果他们得到的是滚动条,那么可能他们的代码的其余部分没有语义,或者他们的数学是错误的……还有一个小问题,当我添加两个以上的朋友时,它会在一行上继续,而不是在下面再做一行。
#profile_friends {
margin-top: 15px;
margin-left: -10px;
background: rgb(240,240,240);
border: 2px solid #555;
border-radius: 3px;
width: 100%;
overflow:hidden;