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 varma
Page 2 of 6
Including an external stylesheet file in your HTML document
The element can be used to include an external style sheet file in your HTML document. An external style sheet is a separate text file with .css extension. You define all the Style rules within this text file and then you can include this file in any HTML document using element. Creating an External CSS File Consider a simple style sheet file with a name new.css having the following rules: h1, h2, h3 { color: #36C; font-weight: normal; letter-spacing: .4em; ...
Read MoreAlign the text of a document with CSS
The text-align property in CSS is used to align the text content within an element. It accepts several values: left (default), right, center, and justify. Syntax text-align: left | right | center | justify; Values left: Aligns text to the left edge (default) right: Aligns text to the right edge center: Centers the text horizontally justify: Spreads text evenly across the width, aligning both left and right edges Example Here's how to use different text alignment values: ...
Read MoreHow much data can I store in JavaScript cookies?
JavaScript cookies have size and quantity limits that vary by browser. Understanding these constraints is essential for effective web storage planning. Cookie Storage Limits by Browser Each browser imposes different limits on cookie storage. Here are the current limitations: Web Browser Maximum Cookies per Domain Maximum Size per Cookie Google Chrome 180 ...
Read MoreHow to call a JavaScript function from an onmouseover event?
The onmouseover event triggers when you bring your mouse over any element. You can call JavaScript functions when this event occurs to create interactive web experiences. Syntax content Method 1: Using DOM Manipulation Modern approach using getElementById() and innerHTML instead of document.write(): function over() { document.getElementById("result").innerHTML = "Mouse Over"; } ...
Read MoreWhat is the difference between single-line and multi-line comments in JavaScript?
JavaScript supports two types of comments: single-line comments using // and multi-line comments using /* */. Comments help document code and are ignored during execution. Single-Line Comments Single-line comments start with // and continue until the end of the line. Everything after // on that line is treated as a comment. Syntax // This is a single-line comment Example // This is a comment explaining the variable let userName = "John Doe"; let age = 25; // Age of the user console.log(userName); // Output the user's name console.log(age); ...
Read MoreWhen should I use a semicolon after curly braces in JavaScript?
In JavaScript, semicolons are optional in many cases due to Automatic Semicolon Insertion (ASI). However, understanding when to use semicolons after curly braces is crucial for writing clean, predictable code. When Semicolons Are Required After Curly Braces Use semicolons after curly braces when they end a statement, not a declaration. Here are the key cases: Function Expressions Function expressions are statements that need semicolons: // Function expression - needs semicolon var greet = function() { alert("Hello World!"); }; // Arrow function expression - needs semicolon const ...
Read MoreDoes a real ECMAScript implementation exist, or is it just a spec?
ECMAScript is a standardization specification, not an actual programming language implementation that you can download and run. Think of it as a blueprint that defines how JavaScript engines should work. What is ECMAScript? ECMAScript (standardized as ECMA-262) is a scripting language specification created to standardize JavaScript. It defines the syntax, types, statements, keywords, and built-in objects that JavaScript implementations should provide. ECMAScript vs JavaScript - Key Differences ECMAScript JavaScript Specification/Standard Implementation of the specification Defines language features Actual runnable code Published by ECMA International Implemented by browser engines ...
Read MoreAnimate CSS column-rule-color property
The CSS column-rule-color property defines the color of the rule (line) between columns in a multi-column layout. You can animate this property to create dynamic visual effects where the column divider changes color over time. Syntax selector { column-rule-color: color; animation: animation-name duration timing-function iteration-count; } @keyframes animation-name { from { column-rule-color: initial-color; } to { column-rule-color: final-color; } } Example The following example demonstrates animating the column-rule-color property from orange to black − ...
Read MoreSet whether the text of the element can be selected or not with CSS
Use the CSS user-select property to control whether the text content of an element can be selected by the user. This property is useful for preventing text selection in UI elements like buttons, navigation menus, or decorative text. Syntax selector { user-select: value; } Possible Values ValueDescription autoDefault behavior - text can be selected noneText cannot be selected textText can be selected allAll content is selected with a single click Example: Preventing Text Selection The following example demonstrates how to prevent text selection using user-select: none ...
Read MoreSet the flex items horizontally with CSS
Use the flex-direction property with row value to set the flex items horizontally. This is the default behavior for flexbox containers, but explicitly setting it ensures your layout behaves as expected. Syntax selector { display: flex; flex-direction: row; } Possible Values ValueDescription rowItems are placed horizontally from left to right (default) row-reverseItems are placed horizontally from right to left columnItems are placed vertically from top to bottom column-reverseItems are placed vertically from bottom to top Example You can try to run the ...
Read More