DEV Community

Cover image for 20 Days of HTML(Learn 20 amazing things about HTML) Part 1
Km-js
Km-js

Posted on • Edited on

2

20 Days of HTML(Learn 20 amazing things about HTML) Part 1

Day 1- Divide webpage into logical sections

⁣HTML5 offers several elements that will help you organize your layout in appropriate sections:⁣⁣

  1. Header <header>
  2. Navigation bar <nav>
  3. Main Content <main> with <article> and <section> ⁣⁣
  4. Sidebar <aside>⁣⁣
  5. Footer <footer>

⁣⁣Good Webpages may look or perform differently but they share similar standard structure.⁣⁣
⁣⁣
By using this standard structure with the semantic elements mentioned above your document becomes more readable and accessible.⁣⁣

Day 2- What are the Semantic elements? Why are they important?

Rather than writing vague divs in your document.
How about using semantic tags?

Semantic tags define the purpose of the element. It's beneficial to use tags, class names and ids that give meaning to your content rather than just define its looks. Presentation is the responsibility of CSS.

For example- <p>,<header>,<figure> tells the content wrapped around them are paragraph, header or image. They help the browser, as well as developers, understand the meaning of their content.

Why is Semantic HTML important?

  • Helps to write clean and maintainable code
  • Enhances Accessibility
  • Improves SEO

Day 3- Make any content on your page editable by users

The text of the webpage can be made editable using the contenteditable attribute.

Just set the contenteditable to true on any of the elements you want to make editable.
It can be helpful in the making of a simple text editor.

<div contenteditable="true">
  Edit me!
</div>
Enter fullscreen mode Exit fullscreen mode

Day 4- Implement a Download button with HTML5

Usually, when the user clicks on a link to media files, it will be opened in the browser.
If you want to give users the option to save that file on their computer, download attribute can be used.

The download attribute to <a> elements makes the linked URL a download link rather than a navigational. Meaning users can save the link rather than navigating to it.

The download attribute can be used with or without value. To rename the default name, a value can be given which becomes the name of the file.

<a href="this-is-the-download-link.pdf" download="Download.pdf">
  Download me
</a>
Enter fullscreen mode Exit fullscreen mode

Day 5- Define options with datalist tag

⁣The Html5 <datalist> tag is used to provide autocomplete feature in the input field of the form.⁣

It specifies the set of predefined options for the user to input.⁣

To bind it to the input, it is usually used with the <input> element's list attribute whose value matches the datalist id.⁣
⁣It works with all types of inputs like data, range, color etc.⁣

<input list="languages" placeholder="Choose language" />
<datalist id="languages">
  <option>Python</option>
  <option>Javascript</option>
  <option>Java</option>
</datalist>

Enter fullscreen mode Exit fullscreen mode

Day 6- Collapsible Sections with HTML5⁣

⁣Details tag is used to make collapsible sections when it is required to provide extra information about a subject that users can hide or view by their choice.

Used with the summary tag which specifies the title that can be clicked to expand or collapse the details.⁣

By default, the details are hidden, the open attribute can be used to change the default behavior.⁣

<details>
<summary> Javascript </summary>
<p> I am an amazing language </p>
</details>
Enter fullscreen mode Exit fullscreen mode

Day 7- Responsive Images with srcset

⁣To make an image responsive means to switch between different versions of the image so that they are being displayed according to their respective device sizes and resolutions.⁣

⁣srcset, an attribute of <img> element is used to give URLs of different versions of the image and a descriptor so that the browser can display the most appropriate one in a given situation.⁣

Here, descriptor x represents device-pixel-ratio i.e a device with 2x resolution will only display the image associated with 2x in the srcset attribute. ⁣

The src attribute is present for browsers that don't understand srcset.

<img srcset="pizza-small.jpg,
             pizza-medium.jpg 1.5x,
             pizza-large.jpg 2x"
     src="pizza-large.jpg"
     alt="a slice of cheesy pizza">
Enter fullscreen mode Exit fullscreen mode

Day 8- HTML Periodic Tables

⁣There exist periodic tables and cheatsheets for HTML elements. ⁣
⁣A great tool to find all the elements with their descriptions in a single place.⁣
These can be very helpful and handy as who remembers all the tags.

https://htmlcheatsheet.com/
https://developer.mozilla.org/en-US/docs/Learn/HTML/Cheatsheet
https://websitesetup.org/html5-periodical-table/

Day 9- All about Quotations

⁣Quotations are an important part of the content.⁣
There are few elements that can be used according to their semantic meanings to display quotations on your page:

The <blockquote> element:

  • Provides a section that defines quotations from another source.⁣
  • Used for indicating long quotations.⁣
  • Cite attribute is used to provide the URL of the source of the quotation.⁣

The <q> element:

  • Provides an inline quote in a block of text. ⁣
  • Used for indicating short quotations.⁣
  • Inserts quotation marks around the enclosed text.⁣

The <cite> element:

  • Provides the title of the source of work(e.g. book, album, song, poem, essay, etc.)⁣
<blockquote>
  The future was uncertain, absolutely, and there were many hurdles, twists, and turns to come, but as long as I kept moving forward, one foot in front of the other, the voices of fear and shame, the messages from those who wanted me to believe that I wasn't good enough, would be stilled.
  ― Chris Gardner,
  <cite>The Pursuit of Happyness</cite>
</blockquote>
<p>
  <q>The goal isn't to live forever, the goal is to create something that will.</q><br>
  ― Chuck Palahniuk, <cite>Diary</cite>
</p>

Enter fullscreen mode Exit fullscreen mode

Day 10- Highlight it!

⁣Ever wanted to have highlighted text on your page?⁣
You can do it with just HTML, use <mark> tag to highlight parts of the text which needs extra attention.⁣

Mostly used with quotations which are from other sources to determine which text is more relevant according to you. ⁣

Don't use it only for decoration purpose.⁣

Difference between <mark> and <strong>-
<mark> denotes relevance of the content, while <strong> indicates importance.

<p>
  <q>The goal isn't to live forever, the goal is to <mark>create something</mark> that will.
  </q><br />
  ― Chuck Palahniuk, <cite>Diary</cite>
</p>
Enter fullscreen mode Exit fullscreen mode


Image of AssemblyAI

Automatic Speech Recognition with AssemblyAI

Experience near-human accuracy, low-latency performance, and advanced Speech AI capabilities with AssemblyAI's Speech-to-Text API. Sign up today and get $50 in API credit. No credit card required.

Try the API

Top comments (1)

Collapse
 
thaisavieira profile image
Thaísa Vieira

What a great journey through HTML! Simple and practical examples, keep going with your learning!

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay