Web Development Articles

Page 694 of 801

The:last-child selector not working as expected in HTML5

Ankith Reddy
Ankith Reddy
Updated on 13-Mar-2026 512 Views

The :last-child CSS selector selects an element only if it is the last child of its parent, regardless of type or class. A common mistake is expecting it to select the last element of a specific type or class within a parent, but that is not how it works. This is why :last-child often does not behave as expected. When :last-child Works The :last-child selector works when the target element is literally the very last child of its parent. For example, if your selector is a:last-child, it matches only if an tag is the last child inside its parent ...

Read More

Facing Problem in retrieving HTML5 video duration

Chandu yadav
Chandu yadav
Updated on 12-Mar-2026 521 Views

A common problem when working with HTML5 video is that the duration property returns NaN (Not a Number) when you try to access it before the browser has finished loading the video's metadata. This happens because the video file's metadata (which contains the duration, dimensions, etc.) is not available immediately after the page loads. Why Does video.duration Return NaN? The HTML5 element has a readyState attribute that indicates how much data the browser has loaded. It has values from 0 to 4 − 0 (HAVE_NOTHING) − No data available yet. 1 (HAVE_METADATA) − Metadata (duration, dimensions) is loaded. ...

Read More

What is the usage of the cross-origin attribute in HTML5?

Arjun Thakur
Arjun Thakur
Updated on 12-Mar-2026 385 Views

The crossorigin attribute in HTML5 is a CORS (Cross-Origin Resource Sharing) settings attribute. It controls how the browser handles cross-origin requests when loading resources like images, scripts, and stylesheets from third-party domains.As the official specification states − The crossorigin attribute is a CORS settings attribute. Its purpose is to allow images from third-party sites that allow cross-origin access to be used with canvas. Why Is the crossorigin Attribute Needed?By default, when you load an image from a foreign origin and draw it onto an HTML5 , the canvas becomes tainted. A tainted canvas cannot be read back using methods like ...

Read More

Remember and Repopulate File Input in HTML5

Nancy Den
Nancy Den
Updated on 12-Mar-2026 413 Views

Browsers do not allow you to programmatically set the value of a file for security reasons. This means you cannot "remember" a previously selected file and repopulate the input on page reload using JavaScript alone. However, HTML5 introduced the Drag and Drop API along with the DataTransfer object, which provides a workaround − users can drag files onto a drop zone, and your code can process those files just like a file input would. How Drag and Drop Works with Files When a user drops a file onto a designated area, the browser fires a drop event. The dropped ...

Read More

Are new HTML5 elements like and useless?

Chandu yadav
Chandu yadav
Updated on 12-Mar-2026 199 Views

No, HTML5 semantic elements like and are not useless. They are extremely useful for screen readers and assistive technologies, helping visually impaired users navigate and understand the structure of your web page. They are also beneficial for eBook readers, search engines, and any tool that parses HTML for meaning. While you could use generic tags for everything, semantic elements convey the purpose of the content to both browsers and developers, making your code more readable and accessible. The Element The element represents a thematic grouping of content, typically with a heading. Use it to divide ...

Read More

HTML5 Canvas to PNG File

Daniol Thomas
Daniol Thomas
Updated on 12-Mar-2026 988 Views

To convert an HTML5 Canvas to a PNG file, you use the canvas.toDataURL() method. This method generates a base64-encoded data URL representing the canvas content as a PNG image. You can then use this data URL to display the image or trigger a file download. How canvas.toDataURL() Works The toDataURL() method returns a string containing the canvas image in the specified format. For PNG, the returned string looks like this − data:image/png;base64, iVBORw0KGgoAAAANSUhEUg.... You can assign this data URL to an tag's src attribute to display the canvas content as a regular image − ...

Read More

Create a tabbed navigation menu with Bootstrap

AmitDiwan
AmitDiwan
Updated on 12-Mar-2026 380 Views

To create a tabbed navigation menu, start with a basic unordered list with the base class of .nav and add class .nav-tabs. The navigation tab looks like the following on a web page − Create a Navigation tab Create a navigation tab with nav and nav-tabs − Home About Products Contact Us Set the Current Page Above, we have set the Home as active, since we wanted it to be the current page − Home Create a Tabbed Navigation Menu with ...

Read More

Set Flex Items into equal width columns with Bootstrap

Amit Diwan
Amit Diwan
Updated on 11-Mar-2026 5K+ Views

To set flex items to be of equal width column, use the flex-fill class. The class displays the items as equal width. In the below example screenshot, you can see that we have four flex items with equal width columns −The flex-fill class is used for every flex items and in this way, we can set equal width. Below, we have two flex items − Example 1 Example 2 Example       Bootstrap Example                                   With flex-fill               Example 1         Example 2         Example 3         Example 4             Without .flex-fill:               Example 1         Example 2         Example 3         Example 4              

Read More

How to clear HTML form fields with jQuery?

usharani
usharani
Updated on 11-Mar-2026 2K+ Views

With jQuery, you can easily clear HTML form fields. For this, jQuery: reset Selector is used. This will clear the HTML form fields.ExampleYou can try to run the following code to clear form fields with jQuery −                          $(document).ready(function(){             $(":reset").css("background-color", "#F98700");          });                              Student Name          Student Subject                              

Read More

Bootstrap btn-group-vertical class

Nancy Den
Nancy Den
Updated on 11-Mar-2026 210 Views

The btn-group-vertical class make a set of buttons appear vertically stacked rather than horizontally.You can try to run the following code to implement btn-group-vertical class:Example           Bootstrap Example                                          BCA          B.Tech                                      Masters                                                        MCA                MBA                M.Tech                M.COM                                

Read More
Showing 6931–6940 of 8,010 articles
« Prev 1 692 693 694 695 696 801 Next »
Advertisements