Work Like A Pro With These 5 HTML Hacks

ZealousWeb
4 min readMar 12, 2021

Right from school, HTML is the first of the many computer basics that we taught, and it stays with us the longest. It is an essential language that is simple to learn and easy to implement even by non-coders. HTML is a standard markup language requiring technologies like Cascading Style Sheet (CSS) and more scripting languages like Javascript.

While a few of us know our way around HTML and the little tips and tricks, some of us beginners are yet to learn a few work hacks. We shall attempt to uncover a few of these work hack to make your coding quicker and sturdy.

Images

SVG

Scalable Vector Graphics (SVG) are tiny in size because that is XML code. It is a bunch of code, so it’s smaller in size and loads faster. When we scale PNG or JPG more than the original size, they get pixelated and reduce the look & fill with your website. But when you scale SVG, it will not pixelate and maintain crisp of the image in all retina. So You can manage it on all devices without quality and load issues.

When we need an image with a shape, people generally save the image with shape as png and use it. But in that case, they will make a compromise with quality. If you don’t want to compromise with the quality, you can add an image in vector shape.

Like this, you can add SVG code with a link on the image.

Figure And Figcaption

when we need in caption image, people generally use <p> after image and show <p> as a caption. but that not the correct way.

Don’t do this

HTML5 has <figure> and <figcaption> tag for that. so you can add image in <figure> tag and caption in <figcaption>.

Do this

Forms

For Clickable Label

Generally, When we want a clickable label for a checkbox or radio, we use a label with a “for” attribute. But if you will put a checkbox or radio in a label, then the label will be automatically clickable if you want more customization. Then you can wrap the text of the label with span or any other tag. You can use “after & before” pseudo-elements for custom designing.

Form Validations

Form validations are good for security purposes. It help’s the user in entering correct data for your website. Some inputs in HTML5 already have predefined validation. Like ‘Email’, ‘URL’, and ‘Tel’. With the Pattern attribute’s help, we can validate the user’s information. With the pattern, we can define custom validation for input using Regular Expressions. Regular Expressions check which expressions the <input> element’s value.

Video

Video background video can reduce the bounce rate. Sometimes readings can be tedious, so that this concept can solve that problem. You need a video which can express your information effectively.

  • Add video in the ratio to ignore cropping issues.
  • If you want your video autoplay, then make it mute first. Because of browser policy, if the user will not interact with the document, the video will not allow autoplay with volume. If you want volume, then you can provide a button for volume.
  • On iPhone, to play video inline, you can add the “playsinline” attribute to the video tag.

HTML

CSS

Meta Tags

Viewport

All devices have not the same width. So the layout needs to fit in each device. If you do not use the viewport meta tag, then the design will show a desktop in devices, and the layout will shrink.

“width=device-width” = This will fit layout in device width.

“initial-scale=1” = On load this will zoom layout to 1.

“maximum-scale=1” = This will not zoom layout more than 1.

“user-scalable=no” = This will prevent user from zoom.

Link Tags

Prefetch

<link rel=”prefetch”> download resources and store in to catch. The browser will not execute any resources which are stored in the catch.

When the user redirects to that page, then page load speed will be increase.

Conclusion

As we saw, HTML stands out to be the easiest coding language to learn and implement. While there are a few more hack that you, as a beginner, can apply in your coding — the above-mentioned cover over 90% of the tricks. In fact, if you’re a front-end developer working for a branding & design agency, you understand the importance and versatility of HTML and how a brand can benefit from it. In case you’re looking for a quick guide and partner, you can reach out to us!

Originally published at https://www.zealousweb.com.

--

--

ZealousWeb

Helping businesses Solve The Unsolved with a tech-first approach to expedite digital transformation.