<small id='mxQZX'></small><noframes id='mxQZX'>

    <i id='mxQZX'><tr id='mxQZX'><dt id='mxQZX'><q id='mxQZX'><span id='mxQZX'><b id='mxQZX'><form id='mxQZX'><ins id='mxQZX'></ins><ul id='mxQZX'></ul><sub id='mxQZX'></sub></form><legend id='mxQZX'></legend><bdo id='mxQZX'><pre id='mxQZX'><center id='mxQZX'></center></pre></bdo></b><th id='mxQZX'></th></span></q></dt></tr></i><div id='mxQZX'><tfoot id='mxQZX'></tfoot><dl id='mxQZX'><fieldset id='mxQZX'></fieldset></dl></div>
    <legend id='mxQZX'><style id='mxQZX'><dir id='mxQZX'><q id='mxQZX'></q></dir></style></legend>
      <tfoot id='mxQZX'></tfoot>

          <bdo id='mxQZX'></bdo><ul id='mxQZX'></ul>
      1. 与 &lt;input type=&quot;radio&gt;&gt; 一起使用的良好

        Good HTML and CSS to use with lt;input type=quot;radioquot;gt;?(与 lt;input type=quot;radiogt;gt; 一起使用的良好 HTML 和 CSS?)
        <i id='pw8v3'><tr id='pw8v3'><dt id='pw8v3'><q id='pw8v3'><span id='pw8v3'><b id='pw8v3'><form id='pw8v3'><ins id='pw8v3'></ins><ul id='pw8v3'></ul><sub id='pw8v3'></sub></form><legend id='pw8v3'></legend><bdo id='pw8v3'><pre id='pw8v3'><center id='pw8v3'></center></pre></bdo></b><th id='pw8v3'></th></span></q></dt></tr></i><div id='pw8v3'><tfoot id='pw8v3'></tfoot><dl id='pw8v3'><fieldset id='pw8v3'></fieldset></dl></div>

            <tbody id='pw8v3'></tbody>

          1. <small id='pw8v3'></small><noframes id='pw8v3'>

              <bdo id='pw8v3'></bdo><ul id='pw8v3'></ul>
              <legend id='pw8v3'><style id='pw8v3'><dir id='pw8v3'><q id='pw8v3'></q></dir></style></legend>

                • <tfoot id='pw8v3'></tfoot>
                • 本文介绍了与 &lt;input type=&quot;radio&gt;&gt; 一起使用的良好 HTML 和 CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在 HTML 中使用 <input type="radio"> 的最佳方式是什么?

                  What's the best way to use <input type="radio"> in HTML?

                  我正在寻找语义良好的 HTML,其格式可通过 CSS 配置.

                  I'm looking for HTML that's semantically good, whose formatting is configurable via CSS.

                  我希望能够对其进行样式/渲染,使其看起来像:

                  I want to be able to style/render it to look something like:

                      Car: (o) Yes
                           (X) No
                           (o) Maybe
                  
                    Train: (o) Yes
                           (o) No
                           (X) Maybe
                  
                  Address: [An input text box     ]
                  

                  考虑到 CSS,我想我希望左侧的标签(例如汽车"和公共汽车")位于某种 text-align: right 块中?

                  Thinking of the CSS, I think that I'd like the labels on the left (e.g. "Car" and "Bus") to be in some kind of text-align: right block?

                  我不知道右边的单选按钮:在某种 <span> 中,也许是 "display: inline-block"?还是 "white-space: pre"?

                  I don't know about the radio buttons on the right: in some kind of <span> perhaps, with "display: inline-block"? Or "white-space: pre"?

                  什么样的块级标签(例如 <p><div>)和/或其他标签(例如 <br/>) 你会推荐吗?

                  What kind of block-level tags (e.g. <p> or <div>) and/or other tags (e.g. <span> or <br/>) would you recommend?

                  下面的怎么样.

                  HTML 使用 <legend>,就像 HTML 应该和 alistapart 文章:

                  HTML uses <legend>, like HTML is supposed to and as recommended in the alistapart article:

                  <fieldset>
                  <legend>Car</legend>
                  <label><input type="radio" name="car" value="yes"/> Yes</label>
                  <label><input type="radio" name="car" value="no"/> No</label>
                  <label><input type="radio" name="car" value="maybe"/> Maybe</label>
                  </fieldset>
                  

                  为了让 Firefox 更容易访问/定位 <legend> 的内容,请将其放在 <span> 中:

                  To make it easer for Firefox to access/position the contents of the <legend>, place it within a <span>:

                  <fieldset>
                  <legend><span>Car</span></legend>
                  <label><input type="radio" name="car" value="yes"/> Yes</label>
                  <label><input type="radio" name="car" value="no"/> No</label>
                  <label><input type="radio" name="car" value="maybe"/> Maybe</label>
                  </fieldset>
                  

                  然后,使用 Legends of样式已修改以将 span 的内容定位到字段集的左侧.

                  Then, use the browser-specific CSS described in Legends of Style Revised to position the contents of the span to left of the fieldset.

                  CSS 真的必须如此复杂和特定于浏览器吗?理论上应该可以工作的最简单的 CSS 是什么,而不是在那些不完美的浏览器上实际工作所需的更复杂的 CSS?如果 <legend> 很难定位,那么有什么好的(语义)替代方案?

                  Does the CSS really have to be so complicated and browser-specific? What's the simplest CSS which ought theoretically to work, instead of the more-complicated CSS required to actually work with those imperfect browsers? If <legend> is hard to position then what's a good (semantic) alternative?

                  推荐答案

                  我将使用

                  .

                  <label> 在不同浏览器中定位的困难在Legends of Style Revised" 文章;因此,与其使用 <label> 并尝试定位它,我可能会在 <字段集>.

                  The difficulty with positioning a <label> in different browsers is described in the "Legends of Style Revised" article; so instead of using a <label> and trying to position it, I might use a <span class="label"> outside the <fieldset>.

                  这篇关于与 &lt;input type=&quot;radio&gt;&gt; 一起使用的良好 HTML 和 CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  keeping radio buttons checked after form submit(表单提交后保持选中单选按钮)
                  Styling radio button - not work in IE and Firefox(样式单选按钮 - 在 IE 和 Firefox 中不起作用)
                  Bootstrap radio button quot;checkedquot; flag(Bootstrap 单选按钮“已选中旗帜)
                  Toggle HTML radio button by clicking its label(通过单击标签来切换 HTML 单选按钮)
                  Javascript how to change radio button label text?(Javascript如何更改单选按钮标签文本?)
                  How can I automatically select specific radio buttons with Greasemonkey?(如何使用 Greasemonkey 自动选择特定的单选按钮?)

                  <small id='p0IvX'></small><noframes id='p0IvX'>

                  1. <legend id='p0IvX'><style id='p0IvX'><dir id='p0IvX'><q id='p0IvX'></q></dir></style></legend>
                      <tbody id='p0IvX'></tbody>

                    <i id='p0IvX'><tr id='p0IvX'><dt id='p0IvX'><q id='p0IvX'><span id='p0IvX'><b id='p0IvX'><form id='p0IvX'><ins id='p0IvX'></ins><ul id='p0IvX'></ul><sub id='p0IvX'></sub></form><legend id='p0IvX'></legend><bdo id='p0IvX'><pre id='p0IvX'><center id='p0IvX'></center></pre></bdo></b><th id='p0IvX'></th></span></q></dt></tr></i><div id='p0IvX'><tfoot id='p0IvX'></tfoot><dl id='p0IvX'><fieldset id='p0IvX'></fieldset></dl></div>
                  2. <tfoot id='p0IvX'></tfoot>

                          <bdo id='p0IvX'></bdo><ul id='p0IvX'></ul>