101.school
CoursesAbout
Search...⌘K
Generate a course with AI...

    Advance CSS

    Receive aemail containing the next unit.
    • CSS Grid Layout
      • 1.1Introduction to grid-based systems
      • 1.2Working with rows and columns
      • 1.3Creating complex, responsive designs
    • CSS Flexbox
      • 2.1Flexbox techniques: alignment and layout
      • 2.2Flexbox controls for UI components
    • Responsive Web Design
      • 3.1Implementing media queries
      • 3.2Employing fluid design principles
    • CSS Preprocessors
      • 4.1Introduction to CSS preprocessors: Sass, Less, and Stylus
      • 4.2Streamlining styling with variables, mixins, and functions
    • CSS Custom Properties (Variables)
      • 5.1Incorporating custom properties in design
      • 5.2Crafting dynamic and themeable styles
    • CSS-in-JS Libraries
      • 6.1Survey of CSS-in-JS solutions
      • 6.2Scoped and encapsulated styles for components
    • Animations and Transitions
      • 7.1Keyframes animations with CSS
      • 7.2Implementing engaging transitions
    • Advanced Selectors and Pseudo-classes
      • 8.1Understanding pseudo-classes
      • 8.2Styling with advanced selectors
    • CSS Architecture and Methodologies
      • 9.1Introduction to BEM and SMACSS
      • 9.2Structuring scalable, organized CSS
    • CSS Transforms and 3D Effects
      • 10.1Introducing CSS transforms
      • 10.2Creating engaging visual effects
    • CSS Filters and Blend Modes
      • 11.1Understanding and applying CSS filters
      • 11.2Creating unique compositions using blend modes
    • Web Fonts and Icon Fonts
      • 12.1Integrating custom web fonts and icon fonts
      • 12.2Enhancing typography and visual elements
    • Accessibility and Inclusive Design
      • 13.1Understanding ARIA roles and attributes
      • 13.2Designing for diverse user needs

    CSS Grid Layout

    Working with Rows and Columns in CSS Grid Layout

    used in graphic design to guide objects

    Used in graphic design to guide objects.

    In this unit, we will delve into the core of the CSS Grid Layout: defining and working with rows and columns. This is the foundation upon which all grid-based designs are built.

    Defining Rows and Columns in a Grid

    The first step in creating a grid layout is defining the grid itself. This is done using the grid-template-rows and grid-template-columns properties. These properties allow you to specify the number and sizes of the rows and columns in your grid.

    For example, if you wanted to create a grid with three columns of equal width, you would write:

    .container { display: grid; grid-template-columns: 1fr 1fr 1fr; }

    In this example, 1fr is a flexible length unit, which represents a fraction of the free space in the grid container.

    Understanding the fr Unit

    The fr unit is a flexible length that represents a fraction of the remaining space in the grid container. This unit allows you to create flexible grids that adapt to the size of their container.

    For example, if you wanted to create a grid with two columns, where the first column is twice as wide as the second, you would write:

    .container { display: grid; grid-template-columns: 2fr 1fr; }

    In this example, the first column will always be twice as wide as the second, regardless of the size of the grid container.

    The grid-auto-rows and grid-auto-columns Properties

    In addition to grid-template-rows and grid-template-columns, CSS Grid also provides the grid-auto-rows and grid-auto-columns properties. These properties are used to specify the size of any rows or columns that are created implicitly.

    For example, if you have more grid items than cells in your grid, CSS Grid will automatically create new rows or columns to accommodate these items. The grid-auto-rows and grid-auto-columns properties allow you to control the size of these implicitly created rows and columns.

    .container { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 100px; }

    In this example, any new rows that are created will have a height of 100px.

    By understanding and effectively using these properties, you can create complex grid layouts that are both flexible and robust. In the next unit, we will explore how to control the spacing between grid items using the grid-gap property.

    Test me
    Practical exercise
    Further reading

    Buenos dias, any questions for me?

    Sign in to chat
    Next up: Creating complex, responsive designs