Html proper style for tags

Html proper style for tags
0.0 0

#1

So this may be a dumb question but what is the proper way to close tags
Ex1:

<section>
        <h1>Title</h1>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Cupiditate, nobis!</p>
        <ul>
            <li>Cat</li>
            <li>Dog</li>
        </ul>
    </section>

or

<section>
        <h1>Title</h1>
        <p>
            Lorem ipsum dolor sit amet consectetur adipisicing elit. Cupiditate, nobis!
        </p>
        <ul>
            <li>
                Cat
            </li>
            <li>
                Dog
            </li>
        </ul>
</section>

#2

Your first example looks cleaner and resembles the way most of us do it. No questions are stupid! :grinning:


#3

The closing of the tags is the same. What you are referring to is the spacing/line placement. When you write it the first way, you guarantee there are no hidden spaces before or after the text. The second way creates more of a blocking. It is really a matter of preference. If all the content for an element will display in the editor on one line, then I will do it like your first example. If the text inside the element is long, then I will go with the second way.


#4

That makes sense I was wondering if there was some standard around it.