[英]Code block spacing within an html list item
我將代碼嵌套在有序列表中,作為一些隊友的一組說明。 但是,當我將代碼塊嵌套在列表項中時,間隔完全消失了。 我的代碼塊中的代碼從頁面寬度的一半開始。 這是一些示例代碼:
<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>
這是因為您要縮進標記中的代碼,請嘗試執行此操作
<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.