A
A
Artemy2018-03-18 18:50:47
HTML
Artemy, 2018-03-18 18:50:47

Does HTML use tabs for lines of code?

Are there generally accepted coding conventions for HTML, and is there a correct one among the following?

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; UFT-8" />    
    </head>
    <body>

    </body>
</html>

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; UFT-8" />    
</head>
<body>

</body>
</html>

Personally, I like the first option more, but the author of the tutorial does not use tabulation at all.
Habr offers this article , which talks about two spaces for code formatting. However, in JetBrains WebStorm, the tab stop is set to 4 spaces by default.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ivan Bogatov, 2018-03-18
@Artemonim

As already answered, it is better to listen to the W3C.) They are more kawaii. And they believe that:
- Instead of a tab, two spaces are better.
- Not everywhere you need even this.
For example, as I understand these words, you can miss the indent between the wrapper and the only content. Those. something like this:

<!doctype html>
<head>
<meta charset="utf-8" />    <!-- Не обижайте html5! -->
</head>
<body>
<header>
  <h1></h1>
  <p></p>
<header>
<main>
  <article></article>
<main>
</body>
</html>

S
Sergey Miller, 2018-03-18
@blackseabreathe

Come on, look at how Google has done it and don't worry5aaeb17fdf023205674285.png

M
Maxim Leskin, 2019-12-08
@Quper24

I'm used to always using tabs in html, css, js
I didn't find why 2 or 4 spaces are better, but shtorm can be configured as needed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question