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
Articles by vanithasree
57 articles
String Formatting in C# to add padding on the right
String formatting in C# provides several ways to add padding to strings. Right padding aligns text to the left by adding spaces to the right side of the string until it reaches the specified width. Syntax Following is the syntax for right padding using composite formatting − string.Format("{0, -width}", value) Following is the syntax for right padding using string interpolation − $"{value, -width}" Following is the syntax for right padding using the PadRight() method − string.PadRight(totalWidth) string.PadRight(totalWidth, paddingChar) Right Padding Visualization ...
Read MoreHow to specify that the element must be filled out before submitting the form in HTML?
The required attribute in HTML is used to specify that a form element must be filled out before the form can be submitted. When a required field is left empty and the user attempts to submit the form, the browser displays a validation message and prevents form submission until the field is completed. The required attribute is a boolean attribute that can be applied to , , and elements. When present, it makes the form field mandatory for successful form submission. Syntax Following is the syntax for the required attribute − ... ...
Read MoreExecute a script each time the playback rate changes in HTML?
The onratechange event attribute in HTML executes a JavaScript function whenever the playback rate of an audio or video element changes. This event is particularly useful for creating custom media controls or displaying the current playback speed to users. Syntax Following is the syntax for the onratechange attribute − ... ... The onratechange attribute can be used with both and elements. The function specified will execute each time the playbackRate property changes. Playback Rate Property The playbackRate property controls the speed at which media content plays − 1.0 ...
Read MoreHow to center canvas in HTML5?
To center a canvas element in HTML5, you can use several CSS techniques. The most common approach is to wrap the canvas in a div and apply text-align: center to the container, or use CSS flexbox for more control over positioning. Syntax Following is the basic syntax for centering a canvas element − Method 1 − Using Text-Align Center The simplest way to center a canvas is to wrap it in a div container and apply text-align: center to the div. Since canvas is an inline element ...
Read MoreHow to set that the specified element/group of elements should be disabled in HTML?
The disabled attribute in HTML is used to make form elements non-interactive and prevent user input or interaction. When an element is disabled, it appears grayed out, cannot receive focus, and its value is not submitted with the form data. Syntax Following is the syntax for the disabled attribute − Or with a value − The disabled attribute is a boolean attribute, meaning its presence alone indicates the element is disabled, regardless of its value. Supported Elements The disabled attribute can be applied to the following ...
Read MoreHow do we include an inline sub window in HTML?
An inline sub window in HTML is created using the (inline frame) tag. An iframe allows you to embed another HTML document or webpage directly within the current page, creating a window-like container that displays external content seamlessly. The iframe element is commonly used to embed videos, maps, social media content, advertisements, or entire web pages from the same or different domains. It acts as a separate browsing context within the main document. Syntax Following is the basic syntax for creating an inline sub window using the iframe tag − The ...
Read MoreHow to set the whitespace between text in CSS?
The CSS white-space property controls how whitespace characters (spaces, tabs, line breaks) are handled within text elements. This property is essential for controlling text formatting and layout. Syntax white-space: value; White-space Property Values Value Spaces/Tabs Line Breaks Text Wrapping normal Collapsed Ignored Yes pre Preserved Preserved No nowrap Collapsed Ignored No pre-wrap Preserved Preserved Yes pre-line Collapsed Preserved Yes Example: Using white-space: pre The pre value preserves all whitespace and line breaks, similar to the HTML tag: ...
Read MoreHow to set named cookies in JavaScript?
To set named cookies in JavaScript, use document.cookie with the format name=value. Named cookies allow you to store multiple key-value pairs that can be retrieved later. Basic Syntax document.cookie = "cookieName=cookieValue; expires=date; path=/"; Example: Setting a Customer Name Cookie function WriteCookie() { if (document.myform.customer.value == "") { alert("Enter some ...
Read MoreUpload from local drive to local filesystem in HTML with Filesystem API
To upload files from your local drive to the local filesystem in the browser, HTML5 provides several powerful APIs that work together. This approach uses the webkitdirectory attribute, Filesystem API, and File API to create a complete file handling solution. Required APIs Three main APIs enable this functionality: webkitdirectory attribute - Allows users to select entire directories through a file dialog Filesystem API - Creates a sandboxed filesystem for storing files on the client's machine File API - Enables reading and processing selected files ...
Read MoreSet the font family with CSS
The font-family property is used to change the face of a font. You can specify multiple font names as fallbacks, and the browser will use the first available font from the list. Syntax font-family: "font-name", fallback-font, generic-family; Example: Setting Font Family This text is rendered in either georgia, garamond, or the default serif font depending ...
Read More