<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 3 年前。
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 3 年前。
以前 legend
-tags 有一个 align
属性,其值为 top
、bottom
、left
和对
。但在 HTML 5 中不再支持此属性。 W3schools advises to use css相反。
但是如何使用 css 将图例定位到字段集的底部,使其看起来像这样:
编辑:澄清一下:我并不是说 HTML 5 不支持 legend
标签,而是 align
属性不再存在。我想将图例放在字段集的底部。
最佳答案
您需要手动定位图例
。
fieldset {
width: 200px;
height: 50px;
position: relative;
top: 50px;
left: 50px;
box-sizing: border-box;
border: solid black 1px;
}
legend {
position: absolute;
bottom: 0;
left: 50%;
transform: translate(-50%, 50%);
padding: 0 5px;
background: white;
}
<fieldset>
<legend>Legend</legend>
Content goes here.
</fieldset>
关于html - 在 HTML5 中将图例置于底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56568028/