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 Samual Sam
Page 45 of 151
Set the font stretch of an element with CSS
The CSS font-stretch property controls the width of characters in a font, allowing you to make text narrower or wider. This property only works if the font family has condensed or expanded variants available. Syntax font-stretch: value; Possible Values The font-stretch property accepts the following values: normal - Default width ultra-condensed - Most narrow extra-condensed - Very narrow condensed - Narrow semi-condensed - Slightly narrow semi-expanded - Slightly wide expanded - Wide extra-expanded - Very wide ultra-expanded - Most wide wider - Relative to parent narrower - Relative to parent ...
Read MoreWhat is the role of pageXOffset property in JavaScript?
The pageXOffset property returns the number of pixels the document has been scrolled horizontally from the left edge of the window. It's a read-only property of the window object used to track horizontal scroll position. Syntax let horizontalScroll = window.pageXOffset; Return Value Returns a number representing the horizontal scroll position in pixels. Returns 0 if the document hasn't been scrolled horizontally. Example: Basic Usage div { ...
Read MorePolymer 1.0 dom-repeat should display index starting at 1 with HTML
Polymer.js is a JavaScript library created by Google that allows reusing HTML elements for building applications with components. When using dom-repeat in Polymer 1.0, the index starts at 0 by default, but you can display it starting from 1. The Problem By default, dom-repeat provides a zero-based index. If you want to display numbers starting from 1 (like a numbered list), you need to add 1 to the index value. Solution: Using a Helper Function Create a helper function that adds 1 to the index: displayIndex: function(index) { return index ...
Read MoreIndent the text of a paragraph with CSS
The text-indent property is used to indent the first line of text in a paragraph or block-level element. This creates a traditional paragraph indentation effect commonly seen in books and formal documents. Syntax text-indent: value; Possible Values Length units: px, em, rem, cm, mm, in, pt Percentage: % (relative to parent element's width) Keywords: inherit, initial, unset Example: Basic Text Indentation Here's how to implement text indentation using different measurement units: ...
Read MoreUsing FFMPEG with HTML5 for online video hosting
HTML5 introduced the native element, enabling browsers to play videos without plugins like Flash. FFMPEG is a powerful command-line tool that can convert videos into HTML5-compatible formats for seamless web streaming. HTML5 Video Formats Modern browsers support three main video formats: Format Codec Browser Support MP4 ...
Read MoreHow to set text font family in HTML?
To change the text font family in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML tag, with the CSS property font-family. HTML5 does not support the tag, so CSS styles are used to control font appearance. Keep in mind that the usage of the style attribute overrides any style set globally. It will override any style set in the HTML tag or external style sheet. Syntax Content here Example: Basic Font ...
Read MoreWhat is the difference between break with a label and without a label in JavaScript?
In JavaScript, the break statement is used to exit loops. Without a label, it exits only the innermost loop. With a label, it can exit any labeled loop, even outer ones in nested structures. Break Without Label The break statement without a label exits only the current loop it's inside. It cannot jump out of nested loops to an outer level. Example var x = 1; document.write("Entering the loop "); ...
Read MoreWhy doesn't JavaScript have a goto statement?
JavaScript does not have a goto statement, despite "goto" being a reserved keyword. The language was designed without goto to encourage structured programming and avoid the problems associated with "spaghetti code". Why goto is Reserved but Not Implemented JavaScript reserves the goto keyword for potential future use, but it has never been implemented. This design decision promotes cleaner, more maintainable code by forcing developers to use structured control flow statements like loops and functions. Problems with goto Statements The goto statement can create several issues: Spaghetti code: Jumps make code flow difficult to follow ...
Read MoreWhat is a fat arrow function in JavaScript?
Fat arrow functions (also called arrow functions) were introduced in ES6 to provide a shorter syntax for writing functions. They use the => syntax, which resembles a "fat arrow", eliminating the need to write the function keyword repeatedly. Syntax For a single argument: argument => expression For multiple arguments or no arguments: (argument1, argument2) => expression // or () => expression Example: Traditional vs Arrow Function Traditional Function: var rank = [7, 8, 9]; var display = rank.map(function(num) { return num * num; ...
Read MoreWhere are JavaScript variables stored?
Like many other programming languages, JavaScript has variables. Variables can be thought of as named containers. You can place data into these containers and then refer to the data simply by naming the container. JavaScript variables are stored in different memory locations depending on their type and scope. Understanding where variables are stored helps optimize performance and avoid memory leaks. Stack vs Heap Memory JavaScript uses two main memory areas for storing variables: Stack Memory: Stores primitive values (numbers, strings, booleans) and function call information Heap Memory: Stores objects, ...
Read More