Using Just createElement() Create a div HTML Element in JavaScript by calling the createElement() method on the document object. This method takes an argument which will be the HTML Element. In this case…div. const box = document.createElement(“div”); box.id = “box”; document.body.appendChild(box); Assign it to the constant called box. Set the id property of box to ‘box‘. Add it to the DOM hierarchy by calling appendChild() on the document.body object with an argument box. Let’s […]
Category: 2023
Prevent text selection CSS
User-select property – prevent text selection To prevent text selection, you can add CSS: p { -webkit-user-select: none; /* Safari */ -ms-user-select: none; /* IE 10 and IE 11 */ user-select: none; /* Standard syntax */ } on specific class .prevent-select {-webkit-user-select: none; /* Safari */ -ms-user-select: none; /* IE 10 and IE 11 */ […]
Set opacity to background image without affecting children (CSS)
background-image: linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,.5)), url(‘https://cataas.com/cat’) article
Web Bluetooth API
This API allows you to connect to and communicate with Bluetooth-enabled devices directly from the browser. With this API, you can create web-based apps that control IoT devices, smart homes, wearables, and other Bluetooth-enabled products.
Web Speech API
This API allows you to add speech recognition and synthesis capabilities to your website. With this API, you can create voice-activated interfaces, enable speech-to-text transcription, and even generate synthesized speech output.