12 Simple HTML Snippets To Avoid Complex Libraries ⚡✨
Tags: html, css, programming, productivity
Published: 2021-10-11 17:38:17

---
title: 12 Simple HTML Snippets To Avoid Complex Libraries ⚡✨
published: true
description: 
tags: html, css, programming, productivity 
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vp46impflwmulu2lo70q.png
---

Not knowing the basic tech can sometimes increase the size, affect the performance and add an extra layer of complexity to the project.

This article is a heads up that you can do a lot with just vanilla [HTML](https://developer.mozilla.org/en-US/docs/Web/HTML) and a bit of [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) if you want it to look pretty.

I have collected some of the most useful HTML tags and attributes, so you can study them and use in your next project.

I also created 12 separate [Codepens](https://codepen.io/collection/mrbBrR?grid_type=grid), so you can get a live taste and play around with the examples.

### 🎨 Color Picker

Often in the developer workflow you might want to access the color spectrum and be able to pick up any shade from it.

You can use `<input type="color">`, which would otherwise be a time-consuming task to write from scratch.

{% codepen https://codepen.io/madarsbiss/pen/vYJBqeX default-tab=result %}

### 📚 Blockquote

When writing articles you might want to highlight some of your favorites quotes. 

You can use a `<blockquote>` tag for that. Add some custom styling and you have a nice element that will stand out from the rest of the text.

{% codepen https://codepen.io/madarsbiss/pen/JjyPQBd default-tab=result %}

### 🎵 Audio Player

Writing your own audio player from scratch can be a challenge. You can use the built-in `<audio>` tag, that provides the basic functionality to play your audio files.

Also, you can listen to more of my music [here](https://madza.dev/music).

{% codepen https://codepen.io/madarsbiss/pen/oNevrEb default-tab=result %}

### 📺 Video Player

Another multimedia you could use in your projects is video. Again, you can not just include the video link in HTML and hope that it will play.

To playback videos properly you can use built-in `<video>` tag.

{% codepen https://codepen.io/madarsbiss/pen/BadBgxJ default-tab=result %}

### 🔷 Accordion

Sometimes you might want to hide some content and allow user to reveal it manually (to save the space of the viewport, for example).

You can achieve the described functionality with pure HTML, thanks to `<details>` tag.

{% codepen https://codepen.io/madarsbiss/pen/zYdOVPV default-tab=result %}

### 📅 Date Picker

Working with dates is among the most common reasons why devs search for external libraries.

HTML provides a `<input type="date">` tag, that provides a nice UI with the option to select the dates by clicking on them.

{% codepen https://codepen.io/madarsbiss/pen/qBXWzXE default-tab=result %}

### ⚪ Slider

Slider is a common component to collect the user input in the specific numeric range.

You can use `<input type="range">` to get a fully functional slider, where you can set the min, max and current value.

{% codepen https://codepen.io/madarsbiss/pen/GRvKbXv default-tab=result %}

### ✍ Content Editor

In order to edit content you don't have to use input or textarea fields and set the default values for them.

Instead, you can use `contenteditable` attribute, that allow to edit the content of the div, for example.

{% codepen https://codepen.io/madarsbiss/pen/ExvYBwB default-tab=result %}

### 📷 Picture Tag

You might want to display different images on different screen sizes to improve the performance and UI/UX.

Instead of using the default `<img>` tag, detect the viewport and creating a method to switch between the images, you can use built-in `<picture>` tag. 

{% codepen https://codepen.io/madarsbiss/pen/abybomY default-tab=result %}

### ⌛ Progress Bar 

The `<progress>` tag represents the completion progress of a task.

You can use it to display various actions, such as a download, file transfer, or installation.

{% codepen https://codepen.io/madarsbiss/pen/oNevKdp default-tab=result %}

### 🔻 Dropdown

Often you might need to collect the user input with multiple possible choices. Instead of listing all the options on the screen, you might include them into dropdown.

Using the `<datalist>` tag will allow users to select options from dropdown, while also allowing to enter their own values.

{% codepen https://codepen.io/madarsbiss/pen/eYEOwdQ default-tab=result %}

### 💭 Tooltip

If you need to give a detailed description of something, it is always nice to include a pop up.

HTML built-in `title` attribute provides that by default.

{% codepen https://codepen.io/madarsbiss/pen/VwzwZvE default-tab=result %}

In this article we reviewed functional HTML elements that you can use while working with text, audio, images, video, etc.

Next time you need the some functionality, make sure to double check if it is not already provided by the HTML itself.

{% twitter 1447623708571541506 %}

<hr>

Writing has always been my passion and it gives me pleasure to help and inspire people. If you have any questions, feel free to reach out!

Connect me on [Twitter](https://twitter.com/madzadev), [LinkedIn](https://www.linkedin.com/in/madzadev/) and [GitHub](https://github.com/madzadev)!

Check out my [portfolio](https://madza.dev/code) for all projects.