Skip to content

Tag attributes

Almost all tags accept attributes. They allow adding very important information either directly for the user (href="linked-page.html" for <a> tags or type="password" for <input> fields), for search engines, for screen readers or other accessibility topics, or for purely visual aspects (CSS).

html
<html>
  <p>
    Try a <a href="https://www.duckduckgo.com">search engine that respects privacy!</a>
  </p>
  <p>
    Oh, what a beautiful logo: <img src="/assets/img/ninja@mini.png">
  </p>
  <p>
    Some
    <span style="color: #1abc9c">text</span>
    <span id="green-sea">of</span>
    <span class="sunflower">all</span>
    <span class="carrot">the</span>
    <span class="peter-river">colors</span>
  </p>
</html>
<style>
#green-sea {
  color: #16a085;
}
.sunflower {
  color: #f1c40f;
}
.carrot {
  color: #e67e22;
}
.peter-river {
  color: #3498db;
}
</style>