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
Web Development Articles
Page 73 of 801
How to create a context menu for an element in HTML5?
The contextmenu attribute in HTML5 was designed to create custom context menus for elements that appear when a user right-clicks. However, this feature has been deprecated and removed from modern browsers due to security and usability concerns. Syntax The original syntax for the contextmenu attribute was − Content Where menu-id is the ID of the associated element with type="context". Original HTML5 Implementation (Deprecated) The contextmenu attribute was intended to work with the and elements to create custom right-click menus. ...
Read MoreCreate a draggable paragraph in HTML5
The draggable attribute in HTML5 allows you to make elements draggable by the user. When set to true, elements can be dragged and dropped using mouse interactions. This feature is commonly used for creating interactive user interfaces, sortable lists, and drag-and-drop file uploads. Syntax Following is the syntax for the draggable attribute − Content The draggable attribute accepts the following values − true − The element can be dragged false − The element cannot be dragged auto − Uses the browser's default behavior Basic Draggable Paragraph To create a ...
Read MoreCreate a hidden paragraph in HTML5
The hidden attribute in HTML5 is used to create elements that are not displayed or relevant to the current page state. When applied to a paragraph or any HTML element, it completely hides the content from both visual display and screen readers, making it semantically irrelevant until the attribute is removed. Syntax Following is the syntax for using the hidden attribute − This paragraph is hidden The hidden attribute is a boolean attribute, meaning its presence alone indicates the element should be hidden. You can also write it as hidden="hidden" or hidden="true", but simply ...
Read MoreCreate a paragraph with a right-to-left direction in HTML5
The dir attribute in HTML sets the text direction for an element's content. To create a paragraph with right-to-left direction, use dir="rtl" on the paragraph element. This is particularly useful for languages like Arabic, Hebrew, Persian, and Urdu that are naturally written from right to left. Syntax Following is the syntax for creating a right-to-left paragraph using the dir attribute − Your text content here The dir attribute accepts three values − rtl − Sets text direction from right to left ltr − Sets text direction from left to right (default) auto ...
Read MoreHow to add multi-language content in HTML?
The lang attribute in HTML allows you to specify the language of content within elements, enabling proper rendering, accessibility, and search engine optimization for multi-language websites. This attribute helps browsers, screen readers, and translation tools understand and process content correctly. Syntax Following is the syntax for the lang attribute − Content The language code follows the ISO 639-1 standard (two-letter codes like en, fr, es) or BCP 47 standard for more specific regional variants (like en-US, fr-CA). Document-Level Language Declaration The most important use of the lang attribute is declaring the primary ...
Read MoreHow to add a unique id for an element in HTML?
The id attribute in HTML is used to assign a unique identifier to any HTML element. This unique ID serves multiple purposes: it allows CSS to target specific elements for styling, enables JavaScript to manipulate individual elements, and provides anchor points for navigation within a page. Syntax Following is the syntax for adding an id attribute to an HTML element − Content The id value must be unique within the entire HTML document and should not contain spaces. It is case-sensitive and typically starts with a letter. Key Rules for ID Attributes ...
Read MoreExecute a script when media data is loaded in HTML?
The onloadeddata event in HTML is triggered when the browser has loaded the current frame of media data (audio or video). This event fires when enough data has been loaded to render the media at the current playback position, making it useful for executing scripts when media becomes ready for playback. Syntax Following is the syntax for the onloadeddata event − ... ... You can also add the event listener using JavaScript − element.addEventListener("loadeddata", functionName); Video Element with onloadeddata Event The onloadeddata event is commonly used with video elements ...
Read MoreHow do we add glossary definitions in HTML?
The definition list in HTML is created using the tag to add glossary definitions and term-description pairs. A definition list consists of terms defined with (definition term) and their corresponding descriptions using (definition description) tags. Definition lists are ideal for glossaries, dictionaries, FAQs, and any content where you need to pair terms with their explanations or definitions. Syntax Following is the syntax for creating definition lists in HTML − Term 1 Description of term 1 Term 2 Description of ...
Read MoreExecute a script when the seeking attribute is set to true indicating that seeking is active in HTML?
The onseeking event attribute in HTML is triggered when the user starts seeking (moving to a different position) in an audio or video element. This event fires when the seeking process begins, before the media actually jumps to the new position. Syntax Following is the syntax for the onseeking event attribute − The onseeking attribute accepts a JavaScript function that executes when the seeking operation starts. This is commonly used to provide user feedback or track user interactions with media content. How It Works When a user drags the progress ...
Read MoreHow do we add a noscript section in HTML?
The noscript tag in HTML provides fallback content for users whose browsers don't support JavaScript or have JavaScript disabled. This tag ensures that your web page remains functional and informative even when scripting is unavailable. The tag can be placed in both the and sections of an HTML document. When JavaScript is enabled, browsers ignore the content inside tags. When JavaScript is disabled or unsupported, browsers display the noscript content instead. Syntax Following is the syntax for the noscript tag − Fallback content for non-JavaScript users ...
Read More