2013-03-26 28 views
0

什么是HTML5ify这个最好的方法?哪些HTML5标签用于包装字典中的定义和示例?

follow: Go or come after (a person or thing proceeding ahead); move or travel behind. 

"She went back into the house, and Ben followed her." 

This?

<article> 
<dfn>follow</dfn>: Go or come after (a person or thing proceeding ahead); move or travel behind. 
<q>"She went back into the house, and Ben followed her."</q> 
</article> 

回答

1

除非你的定义更广泛的像一个百科全书的文章(例如,维基),我不会把它因为<article>标签的物品:

Represents a section of a page that consists of a composition that forms an  
independent part of a document, page, or site. This could be a forum post, 
a magazine or newspaper article, a Web log entry, a user-submitted comment, 
or any other independent item of content. 

对于一系列的,你可能有短期的定义一本书或白皮书的附录,我建议使用数据定义列表:<dl>宽度<dt><dd>分别标记术语和定义。

参考:http://html5doctor.com

有一个关于如何最好地利用HTML5标签得沸沸扬扬,引发了有趣的阅读。

我可能样式该

如果我是一个词汇做一个简单的定义列表,我可能会开始:

<dl> 
    <dt><dfn>follow</dfn>:</dt> 
    <dd> 
     <p>Go or come after (a person or thing proceeding ahead); move or travel 
      behind.</p> 
     <q>She went back into the house, and Ben followed her.</q> 
    </dd> 
</dl> 

和应用一些造型如下:

dl { 
    border: 1px solid #989898; 
    border-radius: 10px; 
    padding: 1.00em; 
} 
dt { 
    margin-left: 1.00em; 
} 
dfn { 
    font-weight: bold; 
    font-size: 1.25em; 
} 
dd { 
    margin-left: 2.00em; 
    margin-bottom: 3.00em; 
} 
dd p { 
    margin: 0 0 0.50em 0; 
} 
dd q { 
    display: block; 
    margin: 0 0 0.50em 0; 
    font-style: italic; 
} 

这只是对布局中各种元素的灵活性和控制力的说明。

小提琴参考:http://jsfiddle.net/audetwebdesign/H6593/

+0

我真的很感激,如果你也可以提供一个关于如何在这种情况下标记例句的见解。也许这不是什么大问题,但我仍然希望从一开始就设计好它。 – whySoSerious 2013-03-26 11:52:54

+0

我提供了一个示例HTML/CSS来说明如何接近布局和样式。 – 2013-03-26 14:42:03

+0

非常感谢,这是一个完整的答案。 – whySoSerious 2013-03-26 14:46:14

0

HTML5元素不需要,它是美好的旧dldtdd的情况下。

例如

<dl> 
    <dt>Thing one</dt> 
    <dd> 
     <p>This defines thing one.</p> 
    </dd> 

    <dt>Thing two</dt> 
    <dd> 
     <p>This defines thing two.</p> 
    </dd> 
</dl> 

dl是一个定义列表,dt是一个定义的术语,dd是定义描述。

+0

OK,问题有所改变,但是这是你对这种情况的基本标记。 – 2013-03-26 11:00:28

+0

这个例子(tag-wise)呢?但是,有人编辑我的问题 – whySoSerious 2013-03-26 11:01:29

+1

尽管HTML5稍微改变了'dl','dt'和'dd'的含义。第一个'd'现在通常意味着“描述”,而不仅仅是“定义”,所以你的'dt's需要包含'dfn's,其中又包含了术语。 – BoltClock 2013-03-26 11:03:51