Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.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
Css 如果容器内有ul,如何使容器100%成为母容器_Css_Html_Html Lists - Fatal编程技术网

Css 如果容器内有ul,如何使容器100%成为母容器

Css 如果容器内有ul,如何使容器100%成为母容器,css,html,html-lists,Css,Html,Html Lists,我有: 我需要对100%的父容器进行.step,如何实现这一点。 html: 您可以设置位置:相对到组 及 至。步骤 我假设您当时只显示一个。步骤元素,我错了吗? 如果希望.group的宽度为100%,则需要以下样式: .group { border: 1px solid red; display:table; /* make the element 100% fill the entire available width */ width: 100%; } .ste

我有:

我需要对100%的父容器进行
.step
,如何实现这一点。 html:


您可以设置
位置:相对

。步骤

我假设您当时只显示一个
。步骤
元素,我错了吗?

如果希望.group的宽度为100%,则需要以下样式:

.group {
    border: 1px solid red;
    display:table; /* make the element 100% fill the entire available width */
    width: 100%;
}
.step {
    border: 1px solid green;
    display:table-cell; /* make the element 100% of its parent's height/equal height columns */
    background-color: yellow;
}
如果希望.step的高度相等,则需要以下样式:

.group {
    border: 1px solid red;
    display:table; /* make the element 100% fill the entire available width */
    width: 100%;
}
.step {
    border: 1px solid green;
    display:table-cell; /* make the element 100% of its parent's height/equal height columns */
    background-color: yellow;
}

您可以指定宽度为100%,高度为100%。stepi已经尝试过了,但它不起作用。您还不能使用CSS根据父级的子级设置父级样式。为此,您需要使用JavaScript。宽度:100%on。步骤将其扩展为您期望的组大小。您是否希望li元素填充到额外的空间中?谢谢@Michael_B,但我需要做
。步骤
.step {
    border: 1px solid green;
    display:table-cell; /* make the element 100% of its parent's height/equal height columns */
    background-color: yellow;
}