Flexbox不填充宽度
我目前正在尝试使用FlexBox创建标头。但是,我试图将两个容器与最左边的两个容器对齐,而一个div向右对齐,但似乎并没有弹性箱容器填充宽度的100%。这会导致问题,因为我无法将DIV一直推向右侧。我该如何解决?
header {
width: 100%;
display: flex;
flex-direction: row;
}
header .header-sm {
justify-content: right;
}
header .logo {
justify-content: left;
}
header nav {
justify-content: left;
}
<header>
<div class="logo"></div>
<nav></nav>
<div class="header-sm"></div>
</header>
感谢您的帮助!
I'm currently trying to create a header using flexbox. However, I'm trying to align two containers to the far left, and one div to the far right, but it doesn't seem like the flexbox container is filling 100% of the width. This causes problems, since I cant push the div all the way to the right. How do I fix this?
header {
width: 100%;
display: flex;
flex-direction: row;
}
header .header-sm {
justify-content: right;
}
header .logo {
justify-content: left;
}
header nav {
justify-content: left;
}
<header>
<div class="logo"></div>
<nav></nav>
<div class="header-sm"></div>
</header>
Thank you for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Jusify-content只能放置在Flex容器级别上,
但在您的情况下,如果您想将特定物品对齐在容器右侧的特定项目,则可以使用
Margin-Left播放:auto
justify-content can only be placed at the flex container level
but in your case if you want to align a specific item to the right of the container you can play with
margin-left: auto