[英]Code block spacing within an html list item
I am nesting code in an ordered list as a set of instructions for some teammates. 我将代码嵌套在有序列表中,作为一些队友的一组说明。 However, when I nest a code block within a list item, the spacing is totally off.
但是,当我将代码块嵌套在列表项中时,间隔完全消失了。 The code in my code block starts halfway through width of the page.
我的代码块中的代码从页面宽度的一半开始。 Here is some sample code:
这是一些示例代码:
<html>
<head>Test</head>
<body>
<ol>
<li> This is a test list item.
<pre>
<code>
def my_function(a):
return a
</code>
</pre>
</li>
<li>Element 2
</li>
</body>
</html>
It's because you're indenting the code in the markup, try this 这是因为您要缩进标记中的代码,请尝试执行此操作
<ol>
<li> This is a test list item.
<pre>
<code>
def my_function(a):
return a
</code>
</pre>
</li>
<li>Element 2
</li>
</ol>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.