seetha

seetha

54 Articles Published

Articles by seetha

54 articles

How do I determine the size of my array in C#

seetha
seetha
Updated on 17-Mar-2026 259 Views

In C#, determining the size of an array is accomplished using the Length property. This property returns the total number of elements in the array as an int value. Syntax Following is the syntax for getting array length − arrayName.Length Parameters The Length property does not take any parameters and returns an integer representing the number of elements. Return Value Returns an int value indicating the total number of elements in the array. Using Length Property for Single-Dimensional Arrays For single-dimensional arrays, the Length property provides a direct count ...

Read More

Print first letter of each word in a string using C# regex

seetha
seetha
Updated on 17-Mar-2026 544 Views

In C#, you can use regular expressions to extract the first letter of each word from a string. This technique uses the Regex.Matches() method with a specific pattern to identify word boundaries and capture the initial characters. Syntax The regular expression pattern to match the first letter of each word is − @"\b[a-zA-Z]" Where − \b − represents a word boundary [a-zA-Z] − matches any single letter (uppercase or lowercase) The Regex.Matches() method syntax − MatchCollection matches = Regex.Matches(inputString, pattern); How It Works ...

Read More

String Formatting in C# to add padding

seetha
seetha
Updated on 17-Mar-2026 1K+ Views

String formatting with padding in C# allows you to align text in columns by adding spaces to the left or right of strings. This is particularly useful for creating formatted tables, reports, or aligned output displays. Padding is controlled by format specifiers that define the width and alignment of each placeholder in the format string. Syntax The basic syntax for padding in format strings is − string.Format("{index, width}", value) Where − index − The parameter index (0, 1, 2, etc.) width − The total width of the field Positive width − ...

Read More

How to specify that the styles only apply to this element's parent element and that element's child elements in HTML?

seetha
seetha
Updated on 16-Mar-2026 314 Views

The scoped attribute was an HTML5 feature designed to limit CSS styles to only apply within a specific parent element and its child elements. However, this attribute was removed from the HTML specification and is no longer supported by modern browsers. Syntax The original syntax for the scoped attribute was − /* CSS rules here would only apply to parent and children */ Why Scoped Was Removed The scoped attribute was removed from HTML5 due to implementation complexity and lack of browser support. Only Firefox provided partial support, ...

Read More

Get the HTTP header for the information of the content attribute in HTML

seetha
seetha
Updated on 16-Mar-2026 371 Views

The http-equiv attribute in HTML is used within tags to simulate HTTP response headers. It provides metadata that would normally be sent by a web server, allowing you to control browser behavior and document properties directly from the HTML. The http-equiv attribute works in conjunction with the content attribute to specify both the header name and its value. This is particularly useful for setting refresh intervals, character encoding, cache control, and other HTTP-like directives. Syntax Following is the syntax for the http-equiv attribute − Where header-name is the HTTP header to ...

Read More

Align text and select boxes to the same width with HTML and CSS

seetha
seetha
Updated on 16-Mar-2026 1K+ Views

When building forms in HTML, text inputs and select dropdowns often appear to have different widths even when the same width is applied in CSS. This happens because browsers handle the box model differently for different form elements, with padding and borders affecting the total rendered size. The solution is to use the CSS box-sizing property set to border-box. This ensures that padding and borders are included within the specified width rather than added to it, making all form elements render at exactly the same visual width. Syntax Following is the syntax for the box-sizing property − ...

Read More

Preventing an image from being draggable or selectable in HTML without using JS

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

Images in HTML are draggable and selectable by default, which allows users to drag them to other locations or select them by double-clicking. You can prevent this behavior using CSS properties without requiring JavaScript. CSS Properties for Preventing Image Interaction The following CSS properties control image dragging and selection − user-drag − Controls whether an element can be dragged by the user. user-select − Controls whether the text of an element can be selected. -webkit-user-drag − WebKit-based browsers (Chrome, Safari) specific property for drag control. -webkit-user-select − WebKit-based browsers specific property for selection control. -moz-user-select − ...

Read More

Splitting up an HTML page and loading it through header?

seetha
seetha
Updated on 16-Mar-2026 246 Views

Splitting HTML pages into separate components like header, footer, and content sections can significantly improve development efficiency and maintainability. This approach allows developers to reuse common elements across multiple pages without duplicating code. HTML Page Structure Header Section Main Content Area Footer Section The three main components typically include − Header − Contains navigation menu, logo, and site-wide elements Content − The main body content that changes between pages Footer − Contains copyright information, links, and contact ...

Read More

How do we add a sample computer code in HTML?

seetha
seetha
Updated on 16-Mar-2026 214 Views

Use the tag to display a sample computer code. The HTML tag is used to display the output of a computer program or sample text that would appear on a computer screen, such as command-line output, error messages, or program responses. Syntax Following is the syntax for the tag − Sample computer output The tag is an inline element that typically displays its content in a monospace font, making it visually distinct from regular text. Basic Example Following example shows how to use the tag to display ...

Read More

What are the ways to include style sheet rules in an HTML document

seetha
seetha
Updated on 15-Mar-2026 633 Views

There are three main ways to include CSS styles in an HTML document: inline styles using the style attribute, internal stylesheets using the element, and external stylesheets using the element. Method 1: Inline Styles Inline styles are applied directly to HTML elements using the style attribute: Inline Styles Example Inline Styled Heading This paragraph has inline styles. Method 2: Internal Stylesheets Internal stylesheets are defined within the element in the document's ...

Read More
Showing 1–10 of 54 articles
« Prev 1 2 3 4 5 6 Next »
Advertisements