Div 不会调整大小
CLOSED
我通过将 2 个子项切换为绝对值来做到这一点,因为它们永远不会扩展,然后我将尺寸不会改变的子项放在顶部,然后将最后一个子项向上移动几个像素,这样它就会覆盖并且仍然可以调整大小父母。
CLOSED
I made it by switching 2 of the children to absolute, because they will never expand, than I putted the children whom size wont change to the top and than I moved the last one upwards by few pixels so it overlays and still can resize the parent.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
绝对定位的元素不占用任何空间,因此更改子元素的数量或大小不会影响父元素的大小。
如果您希望父容器与其子容器一起展开/收缩,则需要浮动容器及其子容器。
Elements that are absolutely positioned do not take up any space, so changes to the number or size of the children will have no effect on the size of the parent element.
If you want the parent container to expand/contract with its children, you need to float both the container and its children.