语义正确的 XHTML 标记
只是尝试掌握使用语义上正确的 XHTML 标记的窍门。
只需编写一个小型导航项的代码即可。每个按钮都有一个有效的标题和描述。因此,我认为定义列表会很棒,所以我写了以下内容
<dl>
<dt>Import images</dt>
<dd>Read in new image names to database</dd>
<dt>Exhibition Management</dt>
<dd>Create / Delete an exhibition </dd>
<dt>Image Management</dt>
<dd>Edit name, medium and exhibition data </dd>
</dl>
但是...我希望上面有 3 个按钮,每个按钮包含 dt 和 dd 文本。我怎样才能用正确的代码做到这一点?通常我会将每个按钮设为一个 div 并将其用于视觉按钮行为(onHover 和当前页面选择内容)。
有什么建议请
谢谢
Just trying to get the hang of using the semantically correct XHTML markup.
Just writing the code for a small navigation item. Where each button has effectivly a title and a descrption. I thought a definition list would therefore be great so i wrote the following
<dl>
<dt>Import images</dt>
<dd>Read in new image names to database</dd>
<dt>Exhibition Management</dt>
<dd>Create / Delete an exhibition </dd>
<dt>Image Management</dt>
<dd>Edit name, medium and exhibition data </dd>
</dl>
But...I want the above to be 3 buttons, each button containing the dt and dd text. How can i do this with the correct code? Normally i would make each button a div and use that for the visual button behaviour (onHover and current page selection stuff).
Any advice please
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这就足够了。
使用
进行导航并不是很聪明。或者在
内使用
和描述。
会让你很头痛,因为它们不在
thats good enough.
using
<dl>
for navigation is not very clever. or use a<span>
inside the<li>
with the description.<dd>
will give you much headache since they aren't inside the<dt>
and don't care about its position and styling我对您使用的术语“按钮”感到有点困惑。如果您指的是链接,那么您可以这样做:
但是,如果您指的是输入标记,那么实现此目的的一种方法是使用 input type=image,然后提供 alt 描述。
例如:
I am slightly confused by the use of your term "button". If you mean a link, then you could do:
If, however, you mean the input tag, then one way to do this would be to use input type=image and then provide an alt description.
For instance:
您可以使用
元素代替
元素:
...
的
元素只需与文档中另一个元素的for
属性label>id
匹配即可有效。You could use
<label>
elements instead of<dt>
elements:... the
for
attribute of the<label>
element need only match theid
of another element in the document to be valid.