Reputation: 879
I have a website or a html page and I want to indent my code for my visitors to see. 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   ; , like the <blockquote> tag. this way, I can use something like this:
<html></html> Using:<head> </head> <body></body><p> Hi</p>
<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.
Upvotes: 4
Views: 3926
Reputation: 304
You can use the pre
tags to make preformatted text which can be indented via normal spaces/tabs.
<pre>
<html>
<head></head><body>
<p>
Hi
</p>
</body>
</html>
</pre>
Upvotes: 2
Reputation: 21396
You may do it with CSS. The text-indent property specifies the indentation of the first line in a text-block. Try;
blockquote {
text-indent: 50px;//define indent in pixels
}
Here is a demo http://www.w3schools.com/cssref/tryit.asp?filename=trycss_text-indent
Upvotes: 0