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 Architecture and Methodologies

    Understanding and Implementing the BEM Methodology in CSS

    family of markup languages for displaying information viewable in a web browser

    Family of markup languages for displaying information viewable in a web browser.

    The Block, Element, Modifier (BEM) methodology is a popular naming convention for classes in HTML and CSS. It was developed by the team at Yandex and is a powerful way of defining and organizing your CSS.

    What is BEM?

    BEM stands for Block, Element, Modifier. It's a methodology that provides a structured approach to organizing your CSS code, making it easier to understand and scale.

    • Block: A block is a standalone entity that is meaningful on its own. For example, a header, container, menu, or footer can be considered as blocks.
    • Element: An element is a part of a block that has no standalone meaning and is semantically tied to its block. For example, a menu item or a header title would be considered elements.
    • Modifier: A modifier is a flag on a block or an element. It's used to change appearance, behavior, or state. For example, a button block might have a modifier of 'disabled' to indicate its state.

    Implementing BEM in CSS

    The BEM methodology involves a specific naming convention that follows this pattern:

    .block {} .block__element {} .block--modifier {}
    • .block represents the higher level of an abstraction or component.
    • .block__element represents a descendent of .block that helps form .block as a whole.
    • .block--modifier represents a different state or version of .block.

    Here's an example of how BEM can be implemented in CSS:

    /* Block component */ .button {} /* Element that depends upon the block */ .button__price {} /* Modifier that changes the style of the block */ .button--orange {} .button--big {}

    In this example, .button is the block, .button__price is an element within the block, and .button--orange and .button--big are modifiers.

    Advantages and Disadvantages of BEM

    The BEM methodology has several advantages:

    • Modularity: BEM can be used to create reusable components.
    • Scalability: BEM provides a clear structure that's easy to understand, making it easier to scale and maintain your code.
    • Code Stability: Using BEM reduces the chance of naming conflicts, as each class has a unique name.

    However, BEM also has a few disadvantages:

    • Verbose class names: BEM results in longer class names, which can make the code harder to read.
    • Learning curve: BEM has a learning curve, especially for beginners.

    Despite these disadvantages, BEM remains a popular methodology for structuring CSS due to its scalability and modularity. Understanding and implementing BEM can significantly improve your CSS code organization and efficiency.

    Test me
    Practical exercise
    Further reading

    My dude, any questions for me?

    Sign in to chat
    Next up: Introducing CSS transforms