Css 如果容器内有ul,如何使容器100%成为母容器
我有: 我需要对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
.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;
}