dl 元素的宽度
我正在根据自己的目的修改 phpbb 民意调查显示。这是我当前的 html 代码,当结果显示打开时:
<div class="content">
<h2>Question</h2>
<p class="author">bla bla <strong>אחת</strong></p>
<dl class="">
<dt><label for="vote_1">option1</label></dt>
<dd style="width: auto;"><input type="radio" name="vote_id[]" id="vote_1" value="1" /></dd><dd class="resultbar"><div class="pollbar" style="width:77%">10</div></dd>
<dd>77%</dd>
</dl>
<dl class="">
<dt><label for="vote_2">Option 2</label></dt>
<dd style="width: auto;"><input type="radio" name="vote_id[]" id="vote_2" value="2" /></dd><dd class="resultbar"><div class="pollbar" style="width:23%">3</div></dd>
<dd>23%</dd>
</dl>
<dl class="">
<dt><label for="vote_3">Option 3</label></dt>
<dd style="width: auto;"><input type="radio" name="vote_id[]" id="vote_3" value="3" /></dd><dd class="resultbar"><div class="pollbar" style="width:0%">0</div></dd>
<dd>No votes</dd>
</dl>
<dl>
<dt> </dt>
<dd class="resultbar">Total : 13</dd>
</dl>
<dl style="border-top: none;">
<dt> </dt>
<dd class="resultbar"><input type="submit" name="update" value="submit" class="button1" /></dd>
</dl>
</div>
<span class="corners-bottom"><span></span></span></div>
<input type="hidden" name="creation_time" value="1326810654" />
问题是这样的:在 phpbb 中,元素与“content”div 具有相同的宽度,因此它们是逐行显示的。然而,在我的代码中,元素的宽度为 0(宽度 0 的确切含义是什么?在屏幕上它们的宽度大于 0),并且所有 -s 都显示在同一行中。
我查看了 css 文件,但据我所知没有什么区别。这里的相关属性是什么?将css文件中的“width”样式选项设置为100%并且“inherit”不起作用。
I am modifying for my purpose the phpbb poll display. This is my current html code when result display is on:
<div class="content">
<h2>Question</h2>
<p class="author">bla bla <strong>אחת</strong></p>
<dl class="">
<dt><label for="vote_1">option1</label></dt>
<dd style="width: auto;"><input type="radio" name="vote_id[]" id="vote_1" value="1" /></dd><dd class="resultbar"><div class="pollbar" style="width:77%">10</div></dd>
<dd>77%</dd>
</dl>
<dl class="">
<dt><label for="vote_2">Option 2</label></dt>
<dd style="width: auto;"><input type="radio" name="vote_id[]" id="vote_2" value="2" /></dd><dd class="resultbar"><div class="pollbar" style="width:23%">3</div></dd>
<dd>23%</dd>
</dl>
<dl class="">
<dt><label for="vote_3">Option 3</label></dt>
<dd style="width: auto;"><input type="radio" name="vote_id[]" id="vote_3" value="3" /></dd><dd class="resultbar"><div class="pollbar" style="width:0%">0</div></dd>
<dd>No votes</dd>
</dl>
<dl>
<dt> </dt>
<dd class="resultbar">Total : 13</dd>
</dl>
<dl style="border-top: none;">
<dt> </dt>
<dd class="resultbar"><input type="submit" name="update" value="submit" class="button1" /></dd>
</dl>
</div>
<span class="corners-bottom"><span></span></span></div>
<input type="hidden" name="creation_time" value="1326810654" />
The problem is this: in phpbb, the elements have the same width as the "content" div, and so they are displayed line-by-line. However, in my code the elements have width 0 (what is the exact meaning of width 0? On-screen they have width larger than 0) and all the -s are displayed in the same line.
I looked around the css files, but as far as I can see there is no difference. What is the relevant property here? Setting 's "width" style option in the css file to 100% and "inherit" has no effect.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该代码看起来像是表格数据的奇怪表示(应该使用
元素来表示),并且可能的目的是使用 CSS 来实现此目的,但不知何故相关的 CSS 代码已经消失丢失的。
如果没有 CSS,每个
dt
和dd
元素都会在自己的一行上呈现,因为这是 HTML 中的默认呈现。百分比宽度大概是用作百分比的图形表示,因此例如 73% 对应于 73% 宽的块。然而,如果没有一些 CSS 使块通过边框或背景颜色可见,就看不到这一点。由于显而易见的原因,这个想法失败了,例如 0%。
如果没有更多的上下文,包括应用的 CSS,就很难说更多。
The code looks like a strange presentation of tabular data (something that should be presented using
<table>
elements), and probably the intent is to use CSS for the purpose but somehow the relevant CSS code has gone missing.Without CSS, each
dt
anddd
element is rendered each on a line of its own, because this is the default rendering in HTML.The percentage widths are presumably meant to act as graphic representation of percentages, so that e.g. 73% corresponds to a 73% wide block. This cannot be seen, however, without some CSS that makes the blocks visible with e.g. border or background color. The idea fails e.g. for 0%, for obvious reasons.
Without more context, including CSS being applied, it’s difficult to say much more.