CSS Articles

Page 41 of 130

How to Align Navbar Items to Center using Bootstrap 4?

Diksha Patro
Diksha Patro
Updated on 15-Mar-2026 10K+ Views

Bootstrap 4 is a popular CSS framework that helps developers create responsive, mobile-first websites quickly and easily. One of the most common design elements in a website is the navigation bar or navbar. In this article, we will discuss how to align the items in a navbar to the center using Bootstrap 4. Methods There are two effective methods to center navbar items in Bootstrap 4 − Method 1: Using Built-in Bootstrap 4 Classes Method 2: Using Custom CSS Method 1: Using Built-in Bootstrap 4 Classes Bootstrap 4 provides the justify-content-center class which ...

Read More

How to Align the modal content box to the center of any screen?

Diksha Patro
Diksha Patro
Updated on 15-Mar-2026 34K+ Views

Centering a modal content box on any screen is essential for creating professional user interfaces. CSS provides several effective methods to achieve perfect center alignment using positioning and flexbox techniques. Syntax /* Method 1: Absolute positioning */ .modal { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } /* Method 2: Flexbox */ .modal-container { display: flex; align-items: center; justify-content: center; } Method 1: Using ...

Read More

How to align an item to the flex-end in the container using CSS ?

Diksha Patro
Diksha Patro
Updated on 15-Mar-2026 2K+ Views

In CSS, aligning items to the flex-end in a container allows you to position flex items at the end of either the main axis or cross axis. This is useful for creating layouts where items need to be positioned at the bottom (cross axis) or right side (main axis) of the container, providing precise control over element positioning in flexbox layouts. Syntax /* Align items to the end of the cross axis (vertical) */ .container { display: flex; align-items: flex-end; } /* Align items to the end of ...

Read More

How to align an item set to its default value in CSS?

Diksha Patro
Diksha Patro
Updated on 15-Mar-2026 949 Views

In CSS, aligning an item to its default value means ensuring that the item maintains the alignment specified by the parent container's align-items property. The default value for align-items is stretch, but you can set it to other values like center, flex-start, and so on. Syntax /* For container-level alignment */ .container { align-items: stretch; /* default value */ } /* For individual item alignment */ .item { align-self: auto; /* inherits from parent */ } /* For inline/table-cell elements */ .element { ...

Read More

How to Add Image into Dropdown List for each items?

Diksha Patro
Diksha Patro
Updated on 15-Mar-2026 8K+ Views

Adding images to dropdown list items enhances the visual appeal and user experience of your web application. This technique uses HTML structure combined with CSS hover effects to create an interactive dropdown menu where each option displays both an icon and text. Syntax .dropdown:hover .dropdown-content { display: block; } .dropdown-content a:hover { background-color: color; } Example: Car Selection Dropdown The following example creates a dropdown menu with car brands, each accompanied by a representative icon − ...

Read More

How to apply two CSS classes to a single element?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 2K+ Views

We can apply multiple CSS classes to a single element by using the class attribute and separating each class with a space. This allows us to combine different styles and create more flexible, reusable CSS designs. Syntax /* Multiple classes in HTML */ ... /* CSS styles for each class */ .class1 { property: value; } .class2 { property: value; } .class3 { property: value; } Method 1: Using the Class Attribute The most common way to apply multiple classes is by listing them in the class attribute, separated by spaces − ...

Read More

How to add multiple font files for the same font using CSS?

Diksha Patro
Diksha Patro
Updated on 15-Mar-2026 14K+ Views

When creating web pages, using multiple font files for the same font family ensures optimal display across different browsers and devices. Some browsers support .woff files while others work better with .ttf or .eot formats. Syntax @font-face { font-family: 'FontName'; src: url('font.woff2') format('woff2'), url('font.woff') format('woff'), url('font.ttf') format('truetype'); } Method 1: Using @font-face Rule The @font-face rule allows you to define custom fonts with multiple file formats as fallbacks. ...

Read More

How to add icons in the button in HTML?

Diksha Patro
Diksha Patro
Updated on 15-Mar-2026 16K+ Views

Icons in HTML buttons help improve user experience by providing visual cues about the button's function. This guide covers two popular methods for adding icons to buttons using modern approaches. Syntax /* Method 1: Font Icons */ button { font-family: icon-font; } /* Method 2: Background Images */ button { background-image: url(icon.png); background-repeat: no-repeat; background-position: center; } Method 1: Using Font Icon Libraries Font libraries like Font Awesome provide scalable vector icons that can be easily styled ...

Read More

How to add gradients to your project using CSS?

Diksha Patro
Diksha Patro
Updated on 15-Mar-2026 480 Views

CSS gradients are smooth transitions between two or more colors that add visual depth and interest to your web designs. They can create backgrounds, textures, and enhance the overall appearance of elements without requiring images. Syntax /* Linear Gradient */ background: linear-gradient(direction, color1, color2, ...); /* Radial Gradient */ background: radial-gradient(shape size at position, color1, color2, ...); Method 1: Using Linear Gradient Linear gradients create smooth color transitions in a straight line. You can control the direction and specify multiple color stops to achieve various effects. Example: Basic Linear Gradient The ...

Read More

How to add Full-Screen Background Video using Tailwind CSS?

Diksha Patro
Diksha Patro
Updated on 15-Mar-2026 7K+ Views

To add full-screen background video using Tailwind CSS, we utilize specific utility classes that control video positioning, sizing, and display properties. Adding a full-screen background video enhances user experience and creates visually engaging web interfaces. Syntax /* Basic full-screen video structure */ .video-container { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; overflow: hidden; z-index: -1; } .video-element { width: 100%; ...

Read More
Showing 401–410 of 1,299 articles
« Prev 1 39 40 41 42 43 130 Next »
Advertisements