HTML

An HTML does not have many important rules, but following these rules will make the life a bit easier.

Basic rules for HTML

Example

<form
    id="a-long-id-string"
    data-form-nonce="9c6b6e43-201e-4f57-bc77-48368a3a1fda"
    method="post"
    action="some/other/url/"
    enctype="multipart/form-data"
>
    <p>Submit some things</p>
    <div class="form-group">
        <label
            class="control-label"
            for="some-input-id"
            data-some-data="9c6b6e43-201e-4f57-bc77-48368a3a1fda"
        >
            Label
        </label>
        <input
            type="text"
            id="some-input-id"
            name="some-input"
            class="form-control"
            placeholder="Write some numbers here"
            inputmode="numeric"
            title="Only integers"
            pattern="[+-]?[0-9]+"
            value="0"
            required
        >
    </div>
    <div class="form-group">
        <input type="submit" value="Submit" class="btn btn-primary">
    </div>
</form>

Django and Jinja Templates

<body>
    {% if something %}
        <h1>Conditional</h1>
        {% for x in y %}
            <p>The value of x is {{ x }}</p>
        {% endfor%}
    {% endif %}
</body>
<p>{{ variable }}</p>
<p>{{ value|title }}</p>
{% block content %}
    <div>
        <h1>{{ title }}</h1>
        {% blocktrans trimmed with foo=variable|filter %}
            Some text with uses {{ foo }} as part of it.
            Can have multiple lines.
        {% endblocktrans %}
        <p id="foo"
            class="class1 class2"
            data-foo="bar"
            data-baz="foo"
        >
            <span>Some text</span>
        </p>
        {% include %}
    </div>
{% endblock %}