vanithasree

vanithasree

57 Articles Published

Articles by vanithasree

57 articles

String Formatting in C# to add padding on the right

vanithasree
vanithasree
Updated on 17-Mar-2026 328 Views

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 More

How to specify that the element must be filled out before submitting the form in HTML?

vanithasree
vanithasree
Updated on 16-Mar-2026 836 Views

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 More

Execute a script each time the playback rate changes in HTML?

vanithasree
vanithasree
Updated on 16-Mar-2026 179 Views

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 More

How to center canvas in HTML5?

vanithasree
vanithasree
Updated on 16-Mar-2026 12K+ Views

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 More

How to set that the specified element/group of elements should be disabled in HTML?

vanithasree
vanithasree
Updated on 16-Mar-2026 157 Views

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 More

How do we include an inline sub window in HTML?

vanithasree
vanithasree
Updated on 16-Mar-2026 567 Views

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 More

How to set the whitespace between text in CSS?

vanithasree
vanithasree
Updated on 15-Mar-2026 277 Views

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 More

How to set named cookies in JavaScript?

vanithasree
vanithasree
Updated on 15-Mar-2026 646 Views

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 More

Upload from local drive to local filesystem in HTML with Filesystem API

vanithasree
vanithasree
Updated on 15-Mar-2026 275 Views

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 More

Set the font family with CSS

vanithasree
vanithasree
Updated on 15-Mar-2026 480 Views

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
Showing 1–10 of 57 articles
« Prev 1 2 3 4 5 6 Next »
Advertisements