如何实现如下图效果,让元素在两侧分布?
template代码如下,
<template>
<div class="top-header">
<div class="header-left" style="display:inline">left</div>
<div class="header-right" style="display:inline">right</div>
</div>
</template>
给 top-header 设置如下即可
.top-header{
/* border-block-end: 1px solid black; */
background-color: #99CCFF;
height: 65px;
display: flex;
justify-content: space-between;
}
注,如果 top-header 还有父级元素,其父级元素不能是 display: flex;