提问者:小点点

如何将fieldset设置为flex,使图例位于内容的左侧?


我想用flex格式化FieldSet/legend,使legend位于FieldSet内容的左侧。我知道我可以float:left这个图例,但在Safari14中,这不起作用。我怎样才能避开这个问题呢?

null

fieldset {
  display: flex;
  align-items: baseline;
}

legend {
  display: block;
  float: left;
  width: 250px
}
<fieldset>
  <legend>Should float in line with content</legend>
  Content
</fieldset>

null


共1个答案

匿名用户

这就是你的目标?

null

fieldset {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
<fieldset>
  <div>Should float in line with content</div>
  <div>Content</div>
</fieldset>