Samual Sam

Samual Sam

1,507 Articles Published

Articles by Samual Sam

Page 40 of 151

Style the numbering characters in an ordered list with CSS

Samual Sam
Samual Sam
Updated on 15-Mar-2026 448 Views

The list-style-type property allows you to control the appearance and style of numbering characters in ordered lists. This CSS property offers various numbering formats including decimal, roman numerals, letters, and more. Syntax list-style-type: decimal | lower-roman | upper-roman | lower-alpha | upper-alpha | none; Common list-style-type Values Value Description Example Output decimal Default numbers 1, 2, 3 lower-roman Lowercase Roman numerals i, ii, iii upper-roman Uppercase Roman numerals I, II, III lower-alpha Lowercase letters a, b, c upper-alpha Uppercase letters A, B, ...

Read More

Clearing the elements of the Queue in Javascript

Samual Sam
Samual Sam
Updated on 15-Mar-2026 456 Views

We can clear all elements from a queue by reassigning the container to an empty array. This is the most efficient way to remove all queue elements at once. Syntax clear() { this.container = []; } Example Here's a complete example showing how the clear method works with a queue implementation: class Queue { constructor(maxSize = 10) { this.container = []; this.maxSize = maxSize; ...

Read More

Difference between dragenter and dragover event in HTML5

Samual Sam
Samual Sam
Updated on 15-Mar-2026 521 Views

HTML5 drag and drop API provides several events to handle dragging operations. Two commonly confused events are dragenter and dragover. While both are essential for drag and drop functionality, they serve different purposes. dragenter Event The dragenter event fires when a dragged element enters a valid drop target. This event is used to determine whether the drop target will accept the drop operation. To accept the drop, you must prevent the default behavior by calling preventDefault(). Drag me Drop zone ...

Read More

Add elements to a PriorityQueue using Javascript

Samual Sam
Samual Sam
Updated on 15-Mar-2026 272 Views

Enqueuing elements to a PriorityQueue means adding them in the array in order of the priority of the element. We'll consider higher numbers to be higher priorities. We'll loop through the container till we find a lower priority and then add the element there. If not, then we'll push it at the end of the container. Note that we're creating the element object with the data and priority. Hence we can implement the enqueue function as follows: The enqueue() Method enqueue(data, priority) { // Check if Queue is full ...

Read More

Specify all the list properties into a single expression with CSS

Samual Sam
Samual Sam
Updated on 15-Mar-2026 169 Views

The list-style property is a CSS shorthand that allows you to specify all list-related properties in a single expression. It combines list-style-type, list-style-position, and list-style-image into one convenient declaration. Syntax list-style: [list-style-type] [list-style-position] [list-style-image]; The values can be specified in any order, and any omitted values will use their default. Properties Combined Property Description Default Value list-style-type Bullet or numbering style disc (ul), decimal (ol) list-style-position Position of marker outside list-style-image Custom image for bullets none Example: Basic List Styling ...

Read More

Peeking elements from a PriorityQueue using JavaScript

Samual Sam
Samual Sam
Updated on 15-Mar-2026 197 Views

Peeking a PriorityQueue means getting the element with the highest priority without removing it from the queue. This operation is useful when you need to inspect the next item to be processed without actually processing it. The peek() Method Implementation The peek function returns the element with the highest priority. In our implementation, elements are stored in ascending order of priority, so the last element has the highest priority: peek() { if (this.isEmpty()) { console.log("Queue Underflow!"); ...

Read More

How to set an element's display type with JavaScript?

Samual Sam
Samual Sam
Updated on 15-Mar-2026 2K+ Views

In JavaScript, you can control an element's visibility and layout behavior by modifying its display property through the DOM. This property accepts various values like block, inline, flex, or none to hide elements completely. Syntax element.style.display = "value"; Where value can be block, inline, flex, grid, none, or other CSS display values. Example: Hiding an Element You can try to run the following code to set an element's display type with JavaScript: ...

Read More

Why cannot I use iframe absolute positioning to set height/width

Samual Sam
Samual Sam
Updated on 15-Mar-2026 571 Views

iFrames are replaced elements in CSS, which behave differently from non-replaced elements like . This difference affects how absolute positioning properties work with dimensions. The Problem with iframe Positioning Unlike regular elements, iframes don't respond predictably to simultaneous top/bottom or left/right positioning for sizing. Setting both top: 0 and bottom: 0 won't automatically stretch an iframe to fill the container height. Solution: Wrapper Div Approach The recommended solution is to wrap your iframe in a element and apply absolute positioning to the wrapper instead. ...

Read More

The PriorityQueue Class in Javascript

Samual Sam
Samual Sam
Updated on 15-Mar-2026 276 Views

A Priority Queue is a data structure where each element has an associated priority. Elements with higher priority are served before elements with lower priority. In JavaScript, we can implement this using a class-based approach. Complete PriorityQueue Implementation Here's a complete implementation of the PriorityQueue class with all essential methods: class PriorityQueue { constructor(maxSize) { // Set default max size if not provided if (isNaN(maxSize)) { maxSize = 10; ...

Read More

Bootstrap Labels

Samual Sam
Samual Sam
Updated on 15-Mar-2026 227 Views

Labels are great for offering counts, tips, or other markups for pages. Bootstrap provides the .label class to create inline labels that complement text content. Basic Label Syntax Use the .label class along with contextual classes to create different styled labels: Default Primary Success Example Here's a complete example showing labels used with headings to display counts: Bootstrap Labels Example ...

Read More
Showing 391–400 of 1,507 articles
« Prev 1 38 39 40 41 42 151 Next »
Advertisements