是否有预代码的标题?
Is there a caption for pre code?
表格有 <caption>
,数字有 <figcaption>
,但是 pre 的正确标签是什么?
(本意是为 listing 添加标题,但似乎 <listing>
已被删除,因此使用 <pre>
代替。)
一张图可以描述一个代码清单,所以只需将 <pre>
放在 <figure>
中,并使用 <figcaption>
作为标题。 spec 包含一个例子:
This example shows the figure
element to mark up a code listing.
<p>In <a href="#l4">listing 4</a> we see the primary core interface
API declaration.</p>
<figure id="l4">
<figcaption>Listing 4. The primary core interface API declaration.</figcaption>
<pre><code>interface PrimaryCore {
boolean verifyDataLine();
void sendData(in sequence<byte> data);
void initSelfDestruct();
}</code></pre>
</figure>
<p>The API is designed to use UTF-8.</p>
表格有 <caption>
,数字有 <figcaption>
,但是 pre 的正确标签是什么?
(本意是为 listing 添加标题,但似乎 <listing>
已被删除,因此使用 <pre>
代替。)
一张图可以描述一个代码清单,所以只需将 <pre>
放在 <figure>
中,并使用 <figcaption>
作为标题。 spec 包含一个例子:
This example shows the
figure
element to mark up a code listing.<p>In <a href="#l4">listing 4</a> we see the primary core interface API declaration.</p> <figure id="l4"> <figcaption>Listing 4. The primary core interface API declaration.</figcaption> <pre><code>interface PrimaryCore { boolean verifyDataLine(); void sendData(in sequence<byte> data); void initSelfDestruct(); }</code></pre> </figure> <p>The API is designed to use UTF-8.</p>