[英]How to indent html code examples
I have a website or a html page and I want to indent my code for my visitors to see. 我有一个网站或一个html页面,我希望缩进代码以供访问者查看。 For example:
例如:
<html>
<head>
</head>
<body>
<pre>
<html>
<body>
<p>
hi
</p>
</body>
</pre>
</body>
</html>
In html, is there a way to indent a block code without using a lot of   ; 在html中,有一种无需使用大量&nbsp即可缩进块代码的方法。 , like the <blockquote> tag.
,如<blockquote>标记。 this way, I can use something like this:
这样,我可以使用这样的东西:
<html></html> Using:<HTML>
<head> </head> <body></body><head>&lt / head> <body>
<p> Hi</p><p>嗨
</ p>
</ BODY>
<blockquote> <html> <blockquote> <head> </head> <body> <blockquote> <p> <blockquote> Hi </blockquote> </p> </blockquote> </body> </blockquote> </html>
I was wondering if there was a better way to indent blocks of code. 我想知道是否有更好的方法来缩进代码块。 If not, I was wondering if there was a way to use css to change it so there is no line on the side and it looks just link a normal indent to the user.
如果没有,我想知道是否有一种方法可以使用css对其进行更改,以使侧面没有行,并且看起来只是将普通缩进链接到用户。
You may do it with CSS. 您可以使用CSS来实现。 The text-indent property specifies the indentation of the first line in a text-block.
text-indent属性指定文本块中第一行的缩进。 Try;
尝试;
blockquote {
text-indent: 50px;//define indent in pixels
}
Here is a demo http://www.w3schools.com/cssref/tryit.asp?filename=trycss_text-indent 这是一个演示http://www.w3schools.com/cssref/tryit.asp?filename=trycss_text-indent
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.