HTML

Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScript.

Table of Contents

Add space between span elements

To render Hello world:

<!-- use whitespace -->
<span>Hello</span> <span>world</span>

<!-- or newline -->
<span>Hello</span>
<span>world</span>

With Pug

If you're using pugjs:

  1. Use pretty in the compile option
  2. Use string interpolation
span Hello
= ' '
span world

Always add type attribute to buttons inside a form

// Vue.js example
<form @submit.prevent='doSomething'>
  <input type='text' name='something' v-model='something'>
  <br>
  <!-- NOTE: type='button' is missing -->
  <button @click='goBack'>Cancel</button>
  <button type='submit'>Save</button>
</form>

When you focus on the textbox and press enter key, it will actually execute the goBack function instead, because the form tries to simulate a click on the first non-button-typed button..