Articles on Trending Technologies

Technical articles with clear explanations and examples

if/else condition in CSS

Mohit Panchasara
Mohit Panchasara
Updated on 15-Mar-2026 6K+ Views

CSS doesn't support traditional if/else conditions like programming languages. However, there are several techniques to achieve conditional styling through CSS pseudo-classes, media queries, and combinators that simulate conditional logic. Syntax /* Using pseudo-classes for conditional styling */ selector:pseudo-class { property: value; } /* Using media queries for responsive conditions */ @media (condition) { selector { property: value; } } Approaches for Using Conditional Styling in CSS Here are three main approaches to implement ...

Read More

Python - Get items in sorted order from given dictionary

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 264 Views

Python dictionaries contain key-value pairs that are unordered by default. Often, we need to display or process dictionary items in sorted order based on their keys. This article explores different methods to sort dictionary items. Using operator.itemgetter() The operator module provides itemgetter() function which can extract specific elements from tuples. Using itemgetter(0) sorts by keys, while itemgetter(1) sorts by values ? import operator data = {12: 'Mon', 21: 'Tue', 17: 'Wed'} print("Given dictionary:", data) print("Sorted by keys:") for key, value in sorted(data.items(), key=operator.itemgetter(0)): print(key, "->", value) Given ...

Read More

How to put the text inside of a created icon?

Mohit Panchasara
Mohit Panchasara
Updated on 15-Mar-2026 929 Views

Sometimes, developers require to put text inside icons. For example, adding the total number of likes inside the 'like' icon makes UI better, adding a comment count inside the comment icon, showing a particular number in any icon, etc. In HTML, we can add the text and icon both separately. After that, we can set the position of the text to place them in the middle of the icon. In this tutorial, we will learn different examples of putting text inside a created icon. Syntax .text { position: absolute; text-align: ...

Read More

Collapsible Pane in Tkinter Python

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 1K+ Views

Tkinter is the GUI building library of Python. In this article, we will see how to create a collapsible pane using Tkinter. Collapsible panes are useful when you have a large amount of data to display on a GUI canvas but don't want it to be visible all the time. They can be expanded or collapsed as needed to save screen space. A collapsible pane typically consists of a toggle button and a frame that can be shown or hidden. When collapsed, only the toggle button is visible. When expanded, the frame containing additional widgets becomes visible. Creating ...

Read More

How to prevent text in a table cell from wrapping using CSS?

Mohit Panchasara
Mohit Panchasara
Updated on 15-Mar-2026 5K+ Views

To prevent text in a table cell from wrapping using CSS, you can use the white-space property. This technique helps maintain better table layout and improves readability by ensuring text remains on a single line within cells. Syntax selector { white-space: nowrap; } Possible Values ValueDescription nowrapPrevents text from wrapping to new lines normalDefault behavior - allows text wrapping prePreserves whitespace and prevents wrapping Example: Preventing Text Wrapping in Table Headers The following example demonstrates how to prevent text wrapping in table headers using the white-space: ...

Read More

Binning method for data smoothing in Python

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 1K+ Views

Data smoothing is a crucial preprocessing technique in statistical analysis that helps reduce noise and makes data more suitable for analysis. The binning method is one approach where we group data values into discrete intervals called bins, making continuous data easier to handle and analyze. Understanding Binning Binning involves creating ranges (bins) and assigning data values to these ranges. The upper boundary of each bin is excluded and belongs to the next bin. This helps in data discretization and noise reduction. Manual Binning Example Let's understand binning with a simple example ? # Given ...

Read More

How to prevent long words from breaking my div?

Mohit Panchasara
Mohit Panchasara
Updated on 15-Mar-2026 2K+ Views

Sometimes, developers require to show long words on the web page. For example, show URLs, long file names, etc. Sometimes, the word length is greater than the parent container's width, and the word breaks the container, causing layout issues and poor visual appearance. For example, when creating a card to show file details, if the file name is very long, it can break the card layout. This article demonstrates how to prevent long words from breaking div elements by using CSS word-wrapping techniques. Understanding the Problem Let's first understand the problem with a visual example − ...

Read More

How to prevent inline-block divs from wrapping?

Mohit Panchasara
Mohit Panchasara
Updated on 15-Mar-2026 5K+ Views

The CSS white-space property can be used to prevent inline-block elements from wrapping to the next line. When you set display: inline-block on elements, they normally wrap when there's insufficient horizontal space. Using white-space: nowrap on the parent container forces all inline-block children to stay on the same line. Syntax .parent-container { white-space: nowrap; } .child-element { display: inline-block; } Example 1: Basic Inline-Block Divs In this example, we create three inline-block divs that won't wrap even when the browser window is resized − ...

Read More

ASCII art using Python pyfiglet module

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 3K+ Views

The pyfiglet module in Python allows you to create stylish ASCII art text with various fonts. This module transforms regular text into large, decorative ASCII representations that are perfect for banners, headers, or creative displays. Installation First, install the pyfiglet module using pip ? pip install pyfiglet Default Font Example The simplest way to create ASCII art is using the default font ? import pyfiglet # Text in default font result = pyfiglet.figlet_format("Python") print(result) ____ _ _ ...

Read More

Inherit a class to another file in Sass

Mohit Panchasara
Mohit Panchasara
Updated on 15-Mar-2026 3K+ Views

The SASS is a pre-processor built on top of the CSS to manipulate the CSS code better. It contains multiple directives and rules, making it easy to write CSS code. It also contains some very useful features such as inheritance, if/else statements, functions, etc. In SASS, we can import one file into another file and use one file's content for another. It also allows us to create inheritance between multiple classes. We can use the @extend directive to inherit one class to another class. By using inheritance in CSS, we can increase the reusability of the code. In ...

Read More
Showing 19601–19610 of 61,297 articles
Advertisements