在API教学页面上封装单词GET最合适的HTML元素是什么?

时间:2021-10-12 18:03:29

I'm working on a page with some API instructions. I make efforts to use proper HTML code, whenever possible, but I'm kind of stumped as to what to use for the word GET (as in this is a GET request, not a PUT request) in the instructions. It isn't a big deal, but it does make me feel like I do my job just a bit better.

我正在处理包含一些API指令的页面。我尽可能地努力使用正确的HTML代码,但是我很难在指令中使用什么用于GET这个词(因为这是一个GET请求,而不是PUT请求)。这不是什么大问题,但它确实让我觉得我的工作做得更好一点。

It's not something that the user types, so <kbd> doesn't really seem relevant. <samp> doesn't seem to fit, either, as it's not something that would be output to the screen. I considered <code>, but that just doesn't sit right.

这不是用户输入的内容,因此看起来并不真实。 似乎也不合适,因为它不会输出到屏幕上。我考虑过,但这并不恰到好处。

A lot of the websites that give API instructions don't seem to care much about semantics.

许多提供API指令的网站似乎并不关心语义。

Any recommendations?

1 个解决方案

#1


5  

From the code element:

从代码元素:

The code element represents a fragment of computer code. This could be an XML element name, a filename, a computer program, or any other string that a computer would recognize.

代码元素表示计算机代码的片段。这可以是XML元素名称,文件名,计算机程序或计算机可识别的任何其他字符串。

So <code> is the right element to represent an HTTP method (since that is a "string that a computer would recognize). You can even add a class.

所以是表示HTTP方法的正确元素(因为它是“计算机可识别的字符串”。)甚至可以添加一个类。

<code class="http"><code class="method">GET</code> <code class="Request-URI URI">/</code> <code class="version">HTTP/1.1</code></code>

#1


5  

From the code element:

从代码元素:

The code element represents a fragment of computer code. This could be an XML element name, a filename, a computer program, or any other string that a computer would recognize.

代码元素表示计算机代码的片段。这可以是XML元素名称,文件名,计算机程序或计算机可识别的任何其他字符串。

So <code> is the right element to represent an HTTP method (since that is a "string that a computer would recognize). You can even add a class.

所以是表示HTTP方法的正确元素(因为它是“计算机可识别的字符串”。)甚至可以添加一个类。

<code class="http"><code class="method">GET</code> <code class="Request-URI URI">/</code> <code class="version">HTTP/1.1</code></code>