简体   繁体   English

HTML 元素无法正确调整大小 - 间距?

[英]HTML element doesn't resize correctly - spacing?

I am trying to keep the same ratio for my html elements and same distance but whenever I resize the window, the objects don't have the same spacing.我试图为我的 html 元素保持相同的比例和相同的距离,但是每当我调整窗口大小时,对象的间距都不相同。 I am not sure what exactly is issue as I have played around with the margins/padding and neither of those work.我不确定到底是什么问题,因为我玩过边距/填充并且这些都不起作用。

Screen smaller屏幕更小

Should look like this应该是这样的

Its better if you can use bootstrap classes instead of using custom css.如果您可以使用引导程序类而不是使用自定义 css,那就更好了。 Anyway you can use this.无论如何你可以使用这个。

.parent{
 display: flex;
 justify-content:space-between;
}

.child{
 display: inline-block
}

You can use below basic styling to fix above issue:您可以使用以下基本样式来解决上述问题:

.parent {
 display: flex;
 justify-content:space-between;
}

.child {
 width: 100%;
 padding: 1rem;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM