Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9061215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:25:43+00:00 2026-06-16T15:25:43+00:00

I have started using BEM methodology while writing my CSS and there have been

  • 0

I have started using BEM methodology while writing my CSS and there have been few occasions where I have struggled to find out the best way to do a particular thing.

I would like to take up a simple example of a panel here.

Lets say I am writing a panel component CSS using BEM style. So my CSS might look as follows:

.panel {}

.panel__titlebar {}

.panel__content { display: none; }

A panel can be either chromeless or with chrome. So I define another modifier class for the panel:

.panel--with-chrome {
 border: 4px solid black;
 border-radius: 4px;
}

Now lets say, the panel can be in a fullscreen/maximized state also in which the chrome and titlebar disappear. Instead of defining modifiers for both panel and titlebar, it would be be wise to define the modifier just on parent (say panel–fullscreen) and rest elements shall change accordingly. So now my CSS becomes:

.panel--fullscreen {
 /* something has to be done here */
}

.panel--fullscreen .panel__titlebar { display: none; }

To remove the chrome in fullscreen mode, I can either:

  1. toggle the panel–with-chrome class in JS along with the panel–fullscreen class

  2. overwrite the chrome CSS inside the panel–fullscreen class.

First isn’t good because ideally I would like to simply toggle just one class (.panel–fullscreen) in JS to toggle fullscreen mode.

And second one is bad because I’ll have to overwrite previous CSS which is a bad practice.

So whats the best way to go about it? Appreciate your comments.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T15:25:45+00:00Added an answer on June 16, 2026 at 3:25 pm

    The answer depends on many things.

    First, how much logic and appearance have “panel–with-chrome” and “panel–fullscreen” modifiers. And also on what kind this logic is.

    If “panel–with-chrome” brings a lot of CSS properties and special JS functionality, I would toggle it in JavaScript when applying “panel–fullscreen”.
    It also depends on a JavaScript framework you use. In “i-bem.js” which we use at Yandex it’s easy to react to appending a modifier:

    • A square changes size modifier when after a click
    • Reacting on applying a modifier

    But if the framework you use doesn’t allow to express such a reaction handy, this answer won’t work that great for you.

    In the other case, when “panel–with-chrome” has not very much properties and doesn’t bring any JavaScript logic to a page, I would redefine those CSS properties in “panel–fullscreen” class.

    To sum up, there is no universal solution and strict rules to follow. You should decide yourself what will be useful in your case. The decision should depend on many things:

    • if you expect your project to be maintained in the future, which solution will be easier to support?
    • capabilities of the JavaScript framework you use
    • performance stuff
      Not in this particular case, but sometimes we measure speed of rendering for variants we are choosing from.
    • opinion of the other guys, if you work in team
    • file structure of your project
      We, here at Yandex, store CSS and JavaScript for a block in the same block folder. So, it is not a problem to share logic between CSS and JavaScript since they all are in one place.
      But if you keep your JavaScript files separately, this can influence on how comfortable it is to support shared logic.

    And so on…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have started using https://github.com/omab/django-social-auth and been successfully able to login via twitter, google
I have started using Star UML application and its great. Is there a way
I have started using Subsonic for a side project and have been loving using
I have started using the Android StrictMode and find that it would be great
I have started using MongoDB and I am fairly new to it. Is there
I have started using the StyleCop and it gives warning wherever there is a
I have started using WebSVN and I'm wondering if there is a correct/propper way
Recently I have started using Lucene. However, after few days I've spotted that queries
I have started using WPF a short while back, and I'm in the progress
I have started using v8js with php for a while now but the documentation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.