Daniol Thomas

Daniol Thomas

124 Articles Published

Articles by Daniol Thomas

124 articles

Execute a script when the browser window is being resized in HTML?

Daniol Thomas
Daniol Thomas
Updated on 16-Mar-2026 327 Views

The onresize attribute in HTML executes a JavaScript function when the browser window is resized. This event is commonly used to adjust layouts, recalculate dimensions, or trigger responsive behavior when users change their window size. Syntax Following is the syntax for the onresize attribute − Content The onresize attribute is typically used on the element or object to detect when the entire browser window is resized. Using onresize with Alert Following example shows how to trigger an alert when the browser window is resized − ...

Read More

How to display a short hint that describes the expected value of the element in HTML?

Daniol Thomas
Daniol Thomas
Updated on 16-Mar-2026 359 Views

The placeholder attribute in HTML displays a short hint that describes the expected value of an input element. This hint appears inside the input field when it is empty and disappears when the user starts typing. It provides users with guidance on what type of information to enter without taking up additional screen space. Syntax Following is the syntax for the placeholder attribute − The placeholder text should be concise and descriptive, helping users understand the expected input format or content. Supported Elements The placeholder attribute works with the following HTML ...

Read More

How to change the text color of an element in HTML?

Daniol Thomas
Daniol Thomas
Updated on 16-Mar-2026 9K+ Views

In HTML, you can change the text color of an element using several methods. While the deprecated tag with the color attribute was used in older HTML versions, modern HTML5 uses CSS for styling text colors through inline styles, internal stylesheets, or external CSS files. Note − The tag and its color attribute are not supported in HTML5 and should be avoided in favor of CSS styling methods. CSS color Property Syntax Following is the syntax for changing text color using CSS − color: value; The value can be specified in ...

Read More

How to store data in the browser with the HTML5 localStorage API?

Daniol Thomas
Daniol Thomas
Updated on 16-Mar-2026 297 Views

HTML5 localStorage is a web storage API that allows you to store data directly in the user's browser. Unlike sessionStorage, which expires when the browser tab is closed, localStorage data persists indefinitely until explicitly removed by the user or the application. The localStorage API provides a simple way to store key-value pairs as strings in the browser. This feature is particularly useful for saving user preferences, form data, application state, or any data that should persist across browser sessions. Syntax Following is the syntax for storing data in localStorage − localStorage.setItem(key, value); localStorage.key = value; ...

Read More

How to draw shapes using SVG in HTML5?

Daniol Thomas
Daniol Thomas
Updated on 16-Mar-2026 2K+ Views

SVG (Scalable Vector Graphics) is a language for describing 2D graphics and graphical applications in XML format. The XML is rendered by an SVG viewer, and most modern web browsers can display SVG just like they display PNG, GIF, and JPG images. SVG graphics are vector-based, making them scalable without quality loss at any size. You can draw various shapes like circles, rectangles, lines, polygons, and more using SVG in HTML5. SVG elements are embedded directly in HTML and can be styled with CSS or manipulated with JavaScript. Syntax Following is the basic syntax for embedding SVG ...

Read More

How to return a string representing the source for an equivalent Date object?

Daniol Thomas
Daniol Thomas
Updated on 15-Mar-2026 144 Views

The toSource() method was a non-standard JavaScript method that returned a string representing the source code of a Date object. However, this method has been deprecated and removed from modern browsers. The Deprecated toSource() Method The toSource() method was originally available in Firefox but was never part of the ECMAScript standard. It would return a string that could theoretically recreate the Date object: // This method is deprecated and no longer works var dt = new Date(2018, 0, 15, 14, 39, 7); // dt.toSource() would have returned: (new Date(1516022347000)) Modern Alternatives Since toSource() ...

Read More

Split Button Dropdowns with Bootstrap

Daniol Thomas
Daniol Thomas
Updated on 15-Mar-2026 621 Views

Split button dropdowns use the same general style as the dropdown button but add a primary action along with the dropdown. Split buttons have the primary action on the left and a toggle on the right that displays the dropdown. Basic Structure A split button dropdown consists of two buttons wrapped in a btn-group container: Primary button: Performs the main action when clicked Dropdown toggle: Shows/hides the dropdown menu with additional options Example You can try to run the following code to create split button dropdowns: ...

Read More

Detect compatibility of the new HTML5 tag with jQuery.

Daniol Thomas
Daniol Thomas
Updated on 15-Mar-2026 194 Views

Use the following to check the compatibility of the HTML5 tag with jQuery: Method: Testing Default Styling This method creates a element and checks if the browser applies the default yellow background color, indicating HTML5 support. function checkMarkTagSupport() { var $myEL = $(''); ...

Read More

What is the correct use of schema.org SiteNavigationElement in HTML?

Daniol Thomas
Daniol Thomas
Updated on 15-Mar-2026 847 Views

The schema.org SiteNavigationElement extends WebPageElement and is used to mark up navigation links on a webpage. It helps search engines understand your site's navigation structure and can enhance search result displays with sitelinks. Basic Syntax The SiteNavigationElement uses microdata attributes to define navigation properties: Link Text Key Properties The main properties used with SiteNavigationElement are: url - The destination URL of the navigation link name - The visible text or name ...

Read More

Difference between Session Storage and Local Storage in HTML5

Daniol Thomas
Daniol Thomas
Updated on 15-Mar-2026 856 Views

HTML5 provides two web storage mechanisms: Session Storage and Local Storage. Both allow web applications to store data locally in the user's browser, but they differ in scope and persistence. Session Storage Session Storage is designed for scenarios where the user is carrying out a single transaction but could be carrying out multiple transactions in different windows at the same time. Data stored in Session Storage is only available for the duration of the page session. // Store data in Session Storage sessionStorage.setItem("username", "john_doe"); sessionStorage.setItem("theme", "dark"); // Retrieve data from Session Storage console.log("Username:", sessionStorage.getItem("username")); ...

Read More
Showing 1–10 of 124 articles
« Prev 1 2 3 4 5 13 Next »
Advertisements