Front End Technology Articles

Page 464 of 652

How to select all children of an element except the last child using CSS?

Tarun Singh
Tarun Singh
Updated on 15-Mar-2026 13K+ Views

To select all children of an element except the last child using CSS we will be understanding two different approaches. Each approach will be using CSS pseudo-class selectors to perform the required task. In this article, we'll see how to select all children of an element except the last child in CSS with different approaches. We will be discussing each approach in detail with examples that will help you understand how they work. Syntax /* Method 1: Using :not() pseudo-class */ parent > *:not(:last-child) { /* styles */ } /* Method ...

Read More

How to select all child elements recursively using CSS?

Tarun Singh
Tarun Singh
Updated on 15-Mar-2026 13K+ Views

To select all child elements recursively using CSS, we use the universal selector (*) with a parent selector. This technique allows you to target all descendant elements, regardless of their nesting level. Syntax /* Select direct children only */ .parent > * { property: value; } /* Select all descendants recursively */ .parent * { property: value; } Example 1: Direct Child Elements Only This example selects only the direct children of the parent container using the child combinator (>) − ...

Read More

How to set indent the second line of paragraph using CSS?

Shabaz Alam
Shabaz Alam
Updated on 15-Mar-2026 3K+ Views

The CSS text-indent property is typically used to indent the first line of a paragraph. However, to create a hanging indent effect where the second and subsequent lines are indented instead of the first line, you need to combine negative text-indent with positive padding-left. Syntax selector { text-indent: negative-value; padding-left: positive-value; } How It Works To indent the second line of a paragraph, we use a two-step approach − Negative text-indent: Moves the first line to the left Positive padding-left: Moves the entire paragraph ...

Read More

How to set div width to fit content using CSS?

Shabaz Alam
Shabaz Alam
Updated on 15-Mar-2026 52K+ Views

To set div width to fit content using CSS is an important task for creating responsive designs and optimal space usage. By default, div elements take the full available width, but we can make them shrink to fit their content. Syntax div { width: max-content; /* or fit-content */ } /* Alternative approach */ div { display: inline-block; } Method 1: Using max-content Width Property The max-content value sets the width to the maximum intrinsic width of the content, allowing the div to expand ...

Read More

How to set color opacity with RGBA in CSS?

Shabaz Alam
Shabaz Alam
Updated on 15-Mar-2026 1K+ Views

The CSS RGBA color model allows developers to set color opacity directly within the color value. RGBA stands for Red, Green, Blue, and Alpha, where the alpha channel controls the transparency of the element. Syntax selector { color: rgba(red, green, blue, alpha); } Where: red, green, blue − Values from 0 to 255 representing color intensity alpha − Value from 0 to 1 representing opacity (0 = transparent, 1 = opaque) What is the RGBA Color Model? RGBA is an extension of the RGB color model with ...

Read More

How to set checkbox size in HTML/CSS?

Shabaz Alam
Shabaz Alam
Updated on 15-Mar-2026 7K+ Views

To set checkbox size in HTML/CSS, we can use several CSS properties to control the dimensions and scaling of checkboxes. By default, checkboxes have a small size that may not be suitable for all designs. Syntax input[type="checkbox"] { width: value; height: value; /* OR */ transform: scale(value); /* OR */ zoom: value; } Method 1: Using Width and Height Properties The most straightforward approach is to use the width and ...

Read More

How to set blur distance in CSS?

Shabaz Alam
Shabaz Alam
Updated on 15-Mar-2026 476 Views

CSS (Cascading Style Sheets) is a powerful tool for designing visual effects on websites. The blur effect is one of the many features in CSS, which is used to blur any element using the filter property with the blur() function. To create a soft, dreamy effect or to draw attention to a specific element on a page, we can use the blur effect. Syntax selector { filter: blur(distance); } The Concept of Blur Distance in CSS Before discussing the practical aspect of setting blur distance, it is important to understand ...

Read More

How to set background-image for the body element using CSS?

Shabaz Alam
Shabaz Alam
Updated on 15-Mar-2026 512 Views

The CSS background-image property is used to set a background image for any HTML element, including the body element. Setting a background image for the body creates a full-page background that enhances the visual appeal of your website. Syntax body { background-image: url('path/to/image.jpg'); } Basic Example Here's a simple example of setting a background image for the body element − body { background-image: url('https://www.tutorialspoint.com/dip/images/einstein.jpg'); ...

Read More

How to set alternate table row color using CSS?

Shabaz Alam
Shabaz Alam
Updated on 15-Mar-2026 11K+ Views

Setting alternate table row colors using CSS, also known as zebra striping, improves table readability by making it easier to distinguish between rows. This technique is essential for creating professional−looking data tables. Syntax /* Using nth-child selector */ tr:nth-child(even) { background-color: color; } tr:nth-child(odd) { background-color: color; } Method 1: Using nth-child Selector The nth-child() selector is the most popular method for creating zebra striping. It selects elements based on their position among all sibling elements − ...

Read More

How to set all the font properties in one declaration using CSS?

Shabaz Alam
Shabaz Alam
Updated on 15-Mar-2026 2K+ Views

CSS provides a shorthand property called font that allows you to set multiple font properties in a single declaration. This property combines font-style, font-variant, font-weight, font-size, line-height, and font-family into one convenient statement. Syntax selector { font: font-style font-variant font-weight font-size/line-height font-family; } Property Values PropertyValuesRequired font-stylenormal | italic | obliqueOptional font-variantnormal | small-capsOptional font-weightnormal | bold | 100-900Optional font-sizepx | em | rem | %Required line-heightnormal | number | lengthOptional font-familyfont names or generic familiesRequired Example 1: Basic Font Shorthand The following example demonstrates setting ...

Read More
Showing 4631–4640 of 6,519 articles
« Prev 1 462 463 464 465 466 652 Next »
Advertisements