我有这样的标记:
HTML:
<ListElementRoot>
<ListElementText>
{children}
</ListElementText>
<ListElementDescription>
{description}
</ListElementDescription>
</ListElementRoot>
Run Code Online (Sandbox Code Playgroud)
//平台.web.js
export const ListElementRoot = div(style.root)
export const ListElementIcon = div(style.icon)
export const ListElementText = div(style.text)
export const ListElementDescription = div(style.description)
Run Code Online (Sandbox Code Playgroud)
//CSS
.root {
display: flex;
width: 100%;
height: 56px;
align-items: center;
border-top: 1px solid var(--color-gray2);
padding: 0;
}
.icon {
position: absolute;
width: 28px;
height: 28px;
align-items: center;
padding-left: 18px;
}
.text {
color: #000;
font-size: calc(var(--font-size-body) / 10)rem;
padding-left: 64px;
}
.description {
color: #000;
font-size: calc(var(--font-size-body) / 12.3)rem;
padding-left: 64px;
}
Run Code Online (Sandbox Code Playgroud)
我是 flexbox 的新手。我怎样才能让元素刚好在 ?
我正在尝试找到一个解决方案,但它在 flexbox 中对我来说严重扭曲(目前)。有任何想法吗?
编辑:
没有 flex-direction: column;
使用flex-direction: column;