Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
HTML Articles
Page 61 of 151
How to count the number of notifications on an icon?
A notification icon is a common UI feature in modern web applications that displays the count of pending notifications. This feature can be implemented using HTML, CSS, JavaScript, and Bootstrap to create an interactive notification system with a badge counter. Required CDN Links To build this notification counter, we need to include the following CDN links in our HTML document − Font Awesome CDN Bootstrap CDN HTML Structure The notification icon consists of a button with a bell icon and a badge counter. The notifications ...
Read MoreMake container shrink-to-fit child elements as they wrap in HTML
Making a container shrink-to-fit its child elements as they wrap is a common CSS layout challenge. This technique ensures that the container only takes up as much width as needed by its content, rather than stretching to fill the available space. We achieve this using CSS Flexbox properties combined with proper container sizing. How It Works The key to making a container shrink-to-fit is using display: inline-flex or display: flex with width: fit-content. The inline-flex display value makes the flex container behave like an inline element, automatically sizing to its content width. When child elements wrap using ...
Read MoreHTML DOM Form submit() method
The HTML DOM Form submit() method is used to programmatically submit form data to the server address specified by the action attribute. This method acts like clicking a submit button, triggering form submission without user interaction. Syntax Following is the syntax for the Form submit() method − formObject.submit() Parameters The submit() method does not take any parameters. Return Value The method does not return any value. It simply submits the form data to the server. Example − Basic Form Submission Following example demonstrates how to use the submit() method ...
Read MoreHow to set the maximum value of progress bar using HTML?
The progress bar on websites represents the completion percentage of tasks like file downloads, form submissions, or data processing. In HTML, the element creates a visual progress indicator that shows how much work is completed versus the total amount. The element uses two key attributes to control its behavior. The max attribute sets the maximum value representing 100% completion, while the value attribute indicates the current progress level. Syntax Following is the syntax for the HTML progress element − The progress bar calculates the completion percentage as: (value / max) ...
Read MoreHow to sort HTML elements by data-attribute?
In HTML, you can sort elements by their data attributes using JavaScript. Data attributes allow you to store custom information directly in HTML elements, which can then be used for sorting, filtering, or other dynamic operations. This technique is particularly useful when you need to reorder elements based on custom criteria without modifying the original HTML structure. Common use cases include sorting product lists by price, organizing content by date, or arranging elements by priority levels stored in data attributes. Syntax Following is the basic syntax for adding data attributes to HTML elements − Content ...
Read MoreHow to use font awesome icon as a cursor?
Web browsers display an arrow cursor by default, but CSS allows us to customize cursor appearance using the cursor property with values like pointer, grab, or zoom-in. However, we can go beyond these predefined options by using Font Awesome icons as custom cursors through HTML5 Canvas and data URLs. How It Works To use a Font Awesome icon as a cursor, we need to − Include the Font Awesome CDN in our HTML document Create an HTML5 element dynamically using JavaScript Draw the Font Awesome icon onto the canvas using its Unicode character Convert the ...
Read MoreHow to use SVG with :before or :after pseudo element?
The :before and :after pseudo-elements in CSS allow you to insert content before or after an element without adding extra HTML markup. These pseudo-elements are particularly useful for decorative content and can be used to display SVG images alongside your existing content. There are two primary methods to use SVG with :before and :after pseudo-elements − Using the content property − Directly embed SVG URLs or inline SVG code in the content property. Using the background-image property − Set SVG as a background image for the pseudo-element. Syntax Following is the basic syntax for ...
Read MoreHow to use text-overflow in a table cell?
The text-overflow property in CSS controls how overflowing text is displayed when it exceeds its container's boundaries. This property is particularly useful in table cells where space is limited and you need to present text in a clean, organized manner. The text-overflow property must be used alongside two essential properties: white-space: nowrap and overflow: hidden. Without these companion properties, text-overflow has no effect. Syntax Following is the syntax for using the text-overflow property in table cells − td { max-width: value; white-space: nowrap; overflow: hidden; ...
Read MoreHow to create a file upload button with HTML?
To create a file upload button with HTML, we use the element with type="file". This creates a button that allows users to select and upload files from their device to a web server. Syntax Following is the basic syntax for creating a file upload button − The type="file" attribute transforms a regular input element into a file selection button. The name attribute identifies the file data when submitted to the server. Basic File Upload Button The simplest file upload implementation requires just the input element within a form. The browser ...
Read MoreHow to create list with roman number indexing in HTML
Roman numerals in HTML lists provide an elegant way to display information in a classical numbering format. The (ordered list) element with the type attribute allows you to create lists using Roman numerals instead of regular numbers. Syntax Following is the syntax for creating Roman numeral lists in HTML − First item Second item Third item The type attribute accepts the following values for Roman numerals − type="I" − Creates uppercase Roman numerals (I, II, III, IV, V...) type="i" − ...
Read More