简体   繁体   English

使Fieldset边框与TextArea匹配

[英]Make Fieldset border match TextArea

What's the best way to make the border around a fieldset more snug to a textarea? 使字段集的边界更贴近文本区域的最佳方法是什么? Consider: 考虑:

<fieldset>
  <legend>Note Edit</legend>
  <textarea rows="30" cols="80" id="myTextArea">
  </textarea>
</fieldset>

...unfortunately, the right-hand fieldset border extends all the way to the far-right of the browser screen, leaving a gap between the right-hand borders of the textarea and the fieldset. ...不幸的是,右侧字段集边框一直延伸到浏览器屏幕的最右边,在文本区域和字段集的右侧边框之间留有间隙。

What's the best way to resolve this? 解决此问题的最佳方法是什么? W3School's fieldset tag reference doesn't mention anything about sizing fieldsets or their borders. W3School的fieldset标签参考未提及有关调整fieldset或其边界大小的任何内容。

Using IE9 on a Win7 machine. 在Win7机器上使用IE9。

Just add the following CSS: 只需添加以下CSS:

fieldset {
    padding:0;
    display:inline;
}

The borders of the fieldset are almost 'attached' to the textarea. 字段集的边界几乎“附加”到了文本区域。

You can see this here-> http://jsfiddle.net/Cu2Nv/1 您可以在这里看到此-> http://jsfiddle.net/Cu2Nv/1

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

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