Work Like A Pro With These 5 HTML Hacks
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.
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>.
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 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 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.
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 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.
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.