Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.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 如果父div大小较小,请在滚动条上指定一个div_Html_Css - Fatal编程技术网

Html 如果父div大小较小,请在滚动条上指定一个div

Html 如果父div大小较小,请在滚动条上指定一个div,html,css,Html,Css,我有固定大小的子div,当液体父div的宽度小于子div时,我希望将子div保持在父div内,并给子div提供滚动条。 HTML 添加溢出:自动到父容器: .parent{ height: 100%; width: 100%; background-color: red; padding: 50px; width: auto; overflow: auto; } 很酷,但我现在如何才能接触到右侧孩子的内容?使用滚动条?我想我不明白 .child{

我有固定大小的子div,当液体父div的宽度小于子div时,我希望将子div保持在父div内,并给子div提供滚动条。

HTML


添加
溢出:自动到父容器:

.parent{
   height: 100%;
   width: 100%;
   background-color: red;
   padding: 50px;
   width: auto;
   overflow: auto;
}

很酷,但我现在如何才能接触到右侧孩子的内容?使用滚动条?我想我不明白
.child{

   width: 500px;
   height: 400px;

   background-color: green;

}

.parent{

   height: 100%;
   width: 100%;
   background-color: red;
   padding: 50px;
   width: auto;
}
.parent{
   height: 100%;
   width: 100%;
   background-color: red;
   padding: 50px;
   width: auto;
   overflow: auto;
}