简体   繁体   English

如何将字段集设置为 flex 以使图例位于内容的左侧?

[英]How can a fieldset be set to flex so that the legend is on the left of the content?

I want to format the fieldset/legend with flex so that the legend is on the left side of the content of the fieldset.我想用 flex 格式化字段集/图例,以便图例位于字段集内容的左侧。 I know I can float:left the legend, but somehow in Safari 14 this does not work.我知道我可以float:left传说,但不知何故在 Safari 14 这不起作用。 How can I get around this issue?我该如何解决这个问题?

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

You can set parent display: inline您可以设置父display: inline

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM