如何在带边框的字段集中定位图例? [英] How to position the legend inside a fieldset with a border?

查看:112
本文介绍了如何在带边框的字段集中定位图例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据网络上的几个参考,不可能定位图例。因此建议使用span:

According to the several references on the web, it is not possible to position a legend. So it is suggested to wrap it with span:

<legend><span>Foo</span></legend>

然后我们可以将span放在fieldset中。但是当我想在字段集的顶部添加一个边框时,有一个传说的缺口。幸运的是,我发现添加边框的传说也修复了这一点,微小的差距,但这是丑陋的解决方案(作为一切与css)。你对这个问题有更有效的解决方案吗?

Then we can position the span inside the fieldset. but then when I want to add a border on top of the fieldset, there is a gap for the legend. Luckily, I've found that adding border to the legend also fixes this little, tiny gap but that's ugly solution (as everything else with css). Do you have any more valid solutions to this problem?

注意:我已经找到了解决方案,我已经开始写这个问题,所以我想仍然

note: I've found the solution concurrently, after I've started writing this question, so I want to still ask it.

推荐答案

我认为这会奏效

 <legend><span>ur text</span></legend>

给图例标签加边框

legend {padding: 2px;border: 1px solid green;}

这篇关于如何在带边框的字段集中定位图例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆