Css Flex/ Start end/ 对齐 3 个组件
Css Flex/ Start end/ aligning 3 components
您好,我需要一个具有 3 条对齐方式的按钮
左边一个图标
div
中间一个按钮,最后一个按钮
<Content>
<Image src = { logo } style = {{width:'50px'}}/>
<Button />
<Button />
</Content>
css:
export const wrapStyle = css`
min-height: 55px;
max-height: 55px;
width:100%;
background: yellow;
padding: 0 !important; `;
export const contentLogo = css`
width:240px;
height:100%;
background-color: rgba(31,30,30,.12)!important;
line-height: 52px;
padding-left: 20px;
padding-right: 20px;
display: flex;
align-items: center;
position: relative;
transition: all .3s; `;
像这样:
我认为最好的方法是使用 flex end start 等
我试过了但是不行
像这样
body {
margin: 0;
}
#container {
display: flex;
justify-content: space-between;
align-items: center;
background: purple;
padding: 1rem;
}
.flex-item {
color: #fff;
}
<div id="container">
<div class="flex-item"> Item One </div>
<div class="flex-item"> <h1>Item Two</h1> </div>
<div class="flex-item"> Item Three </div>
</div>
您好,我需要一个具有 3 条对齐方式的按钮
左边一个图标 div
中间一个按钮,最后一个按钮 <Content>
<Image src = { logo } style = {{width:'50px'}}/>
<Button />
<Button />
</Content>
css:
export const wrapStyle = css`
min-height: 55px;
max-height: 55px;
width:100%;
background: yellow;
padding: 0 !important; `;
export const contentLogo = css`
width:240px;
height:100%;
background-color: rgba(31,30,30,.12)!important;
line-height: 52px;
padding-left: 20px;
padding-right: 20px;
display: flex;
align-items: center;
position: relative;
transition: all .3s; `;
像这样:
我认为最好的方法是使用 flex end start 等
我试过了但是不行
像这样
body {
margin: 0;
}
#container {
display: flex;
justify-content: space-between;
align-items: center;
background: purple;
padding: 1rem;
}
.flex-item {
color: #fff;
}
<div id="container">
<div class="flex-item"> Item One </div>
<div class="flex-item"> <h1>Item Two</h1> </div>
<div class="flex-item"> Item Three </div>
</div>