Imports | CSS | Tutorial 15

Share

Summary

Learn how to use @import in CSS to combine multiple CSS files into one. This tutorial explains the process, benefits for organization, and potential performance considerations.

Highlights

Introduction to CSS Imports
00:00:00

This tutorial explains how to use @import in CSS to bring styling from external files into a main CSS file. This helps with organizing CSS code across multiple files.

Demonstrating CSS Imports
00:00:23

The video demonstrates importing 'header.css' and 'paragraph.css' into 'style.css'. Initially, 'header.css' makes headers green. After importing, the styling is applied to the webpage.

Overriding Imported Styles
00:01:28

It's possible to override imported styles by defining new rules in the main CSS file. For example, changing headers from green to red overrides the imported style, demonstrating that local rules take precedence.

Modularity and Performance Considerations
00:02:07

Using imports helps with modularization and organization of CSS files. However, it's important to be aware that each @import statement on a web server generates an additional HTTP request, potentially slowing down website load times if numerous imports are used. For a few imports, the impact is minimal, but many imports can significantly increase load time.

Recently Summarized Articles

Loading...