{"id":20105695,"url":"https://github.com/autruonggiang/learn-bem","last_synced_at":"2025-06-20T09:34:34.689Z","repository":{"id":220444423,"uuid":"751655632","full_name":"autruonggiang/learn-BEM","owner":"autruonggiang","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-13T13:56:54.000Z","size":480,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-02T17:48:17.993Z","etag":null,"topics":["bem","bem-css","css","css-bem","f8","html"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/autruonggiang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-02T03:17:29.000Z","updated_at":"2024-02-14T05:11:07.000Z","dependencies_parsed_at":"2024-02-02T04:32:41.057Z","dependency_job_id":"1d3467a0-2227-4365-a1ed-1e2dd8265651","html_url":"https://github.com/autruonggiang/learn-BEM","commit_stats":null,"previous_names":["autruonggiang/learn-bem"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/autruonggiang/learn-BEM","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autruonggiang%2Flearn-BEM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autruonggiang%2Flearn-BEM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autruonggiang%2Flearn-BEM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autruonggiang%2Flearn-BEM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/autruonggiang","download_url":"https://codeload.github.com/autruonggiang/learn-BEM/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autruonggiang%2Flearn-BEM/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260919445,"owners_count":23082760,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bem","bem-css","css","css-bem","f8","html"],"created_at":"2024-11-13T17:47:45.077Z","updated_at":"2025-06-20T09:34:29.649Z","avatar_url":"https://github.com/autruonggiang.png","language":"HTML","readme":"# BEM\n- The naming standard for writing CSS.\n\n## Meaning:\n- Abbreviation for: Block Element Modifier.\n    + Block: Container.\n    + Element: Component within the container.\n    + Modifier: Adds meaning to a Block or Element.\n\n## Why use BEM?\n- Consistency in naming conventions.\n- Avoids conflicts when multiple developers work on the same project.\n\n- Prevents CSS styles from being overridden by others.\n\n## Syntax\n- .block\n- .block__element\n\n- .block--modifier\n- .block__element--modifier\n\n## Applications\n- Building website layouts.\n- Constructing components on a website.\n\n## Advantages\n- Clear and consistent naming.\n- Easy reusability of code.\n- Facilitates collaboration within a team.\n- Encourages a modular approach, reducing the risk of style conflicts.\n\n## Disadvantages\n- Longer class names.\n- Some find it visually unappealing.\n\n## When is BEM suitable?\n- Large projects with multiple team members.\n- Projects with numerous pages or a high number of interface components.\n\n## Practical examples\n- Creating a button.\n    + Enabled: Pointer, hover effect.\n    + Disabled: Arrow, no effect.\n- Designing a message.\n- Developing a component for a website.\n\n## Nested Blocks in BEM\nIn cases where a Block contains another Block:\n\n- The child Block serves as a shared component.\n- The child Block contains multiple elements.\n\n## References\n- https://codepen.io/ng-ngc-sn-the-bashful/pen/VwKXNyK\n- https://codepen.io/ng-ngc-sn-the-bashful/pen/Exgmxqp\n- https://getbem.com/introduction/\n- https://dev.to/arshadayvid/write-structured-css-using-bem-syntax-16gd\n- https://www.geeksforgeeks.org/understanding-the-css-bem-convention/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautruonggiang%2Flearn-bem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fautruonggiang%2Flearn-bem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautruonggiang%2Flearn-bem/lists"}