Using BEM in Conjunction with CSS Frameworks

Can BEM methodology be effectively used with CSS frameworks like Bootstrap? Which markup structure is better suited for this purpose:

 <div class="hero">
    <div class="container">
       <div class="row">
        <div class="col-md-8 mx-auto">
          <h1 class="hero__title"></h1>
        </div>
      </div>
    </div>
  </div>

or should the document be structured like this:

<div class="hero">
  <div class="hero__container">
    <div class="hero__row">
      <div class="hero__row-inner">
        <h1 class="hero__title"></h1>
      </div>
     </div>
   </div>
</div>

Answer №1

It is not recommended to implement the BEM methodology for utility classes such as "container, row, col", but you can consider using helper situations like col col--xs-12 or img img--cover.

To explore more utility classes, refer to the bootstrap documentation: https://getbootstrap.com/docs/4.4/utilities/borders/

<div class="hero">
  <div class="container">
       <div class="row">
        <div class="col-md-8 mx-auto">
          <h1 class="hero__title"></h1>
        </div>
      </div>
    </div>
</div>

Consider using this code block as your primary reference.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

To ensure font-weight is applied to innerHTML text on Laravel, it must be styled with a white color for the changes to take

I have added a countdown feature to my Laravel 5 application and I am trying to adjust the font weight of the text, but I am facing some difficulties. When I set the color to #fff, the font-weight works perfectly fine, but when I change the color, the font ...

Issue with Fancybox's close button not being displayed when using a different template

On one of my pages, I'm trying to use two different FancyBox styles for different elements. To accomplish this, I have included the tpl option and made adjustments to the stylesheet. Here is what I currently have: $(document).ready(function() { $(".l ...

What steps can be taken to solve the JavaScript error provided below?

My objective is to create a new variable called theRightSide that points to the right side div. var theRightSide = document.getElementById("rightSide"); Once all the images are added to the leftSide div, I need to use cloneNode(true) to copy the left ...

Issues with the proper functioning of the mr-auto class in Bootstrap 4

I am currently working with a code snippet: <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin=" ...

The dynamic duo of web development: React and Bootstrap JavaScript

As I work with ReactJS, I have come to understand that using JQuery or vanilla JS to directly manipulate the DOM is not recommended. This is because ReactJS operates using a virtual DOM, which can lead to unpredictable outcomes. My question now is: if I w ...

Can Visual Studio be integrated with a CMS platform?

For my final year of study in Information Systems, I am tasked with creating an MVC asp.net website using MS Visual Studio. I am wondering if there is a way to integrate the code with an HTML drag-and-drop CMS instead of relying solely on Visual Studio&apo ...

Incorporating a stationary sidebar onto your website

My goal is to create a fixed side menu similar to the one on this website: Below is my HTML code: <!-- Scroll TEST --> <ul id="followTab"> <li> <a class="newsletter" href="newsletter/" title="Subscribe to ..."> ...

Error encountered: 'JQuery not defined' pops up following the installation of angular-slickgrid

I want to start by explaining that I have carefully followed all the steps outlined in https://github.com/ghiscoding/angular-slickgrid/wiki/HOWTO---Step-by-Step before proceeding. Now, let me show you the specific steps I have taken: Firstly, I installe ...

Creating a responsive CSS image overlay using bootstrap

I am struggling with making the height of an image overlay responsive while maintaining the aspect ratio. I have tried defining it in pixels, but it doesn't work as intended. Here is the snippet of my HTML code: <ul class="img-list"> <li& ...

Embedding the scrollbar within the div container

I'm having trouble placing my vertical scrollbar inside my div and adjusting its position. To streamline the code, I have extracted a portion below: .toprightcontrols { margin: 0 3% 0 0; display: flex; position: absolute; justif ...

Upon clicking the navbar dropdown item, it shifts its position

I am currently working on setting up a navigation bar with multiple items aligned to the right side. However, I have encountered an issue where clicking on the "notification" icon causes the other icons in the navbar to move instead of remaining fixed in p ...

An exciting tutorial on creating a animated dropdown using vueJS

I've set up a navigation menu with mouseover and mouse leave events to toggle a dropdown by changing a boolean value. Now, I'm trying to apply different animations to the list items in the dropdown compared to the surrounding box, but I'm f ...

using angularjs to dynamically apply css styles

Below is the input I have: The HTML code is shown below: <input type="number" ng-class="{negative: amount < 0}" ng-model="amount"/> This is the corresponding CSS code: .negative { color: red; } If the amount is positive, no specif ...

The width of table cells within a div is completely disregarded

The cell width property seems to be ignored in this situation. Despite trying numerous approaches, the cells are splitting into equal portions and not respecting the specified width. Inspecting the code did not reveal any unexpected inheritance that could ...

Adjusting the Width of a Scrollbar with CSS

I've implemented a CSS style to adjust the width of the scroll bar in my DIV element. However, I've noticed that in some areas of the div tag on the same page, the width is accurate while in others it appears incorrect. My question is, if I appl ...

Tips for positioning and styling submenu on dropdown using CSS

I am facing an issue with my navigation menu in the design. The sub menu is not displaying when hovered. Is there a solution to fix this problem? Could it be due to missing CSS styles? nav ul {list-style-type: none; overflow: hidden; background: #000; p ...

Conceal the rotation controls within the react-select element

Incorporating the react-select component into my project has been a great addition. However, I encountered an issue when testing in the Windows/Chrome browser - spin buttons started showing up unexpectedly. https://i.sstatic.net/DiZ0W.png After conducting ...

Are there any alternative methods to avoid duplication of Navbar link margin classes in Tailwind CSS?

It feels really repetitive to have to add margin classes to each LI manually on a non-dynamically generated menu. It almost seems as messy as using inline style attributes... Is there a more efficient way to handle this? While it may not be a big deal fo ...

How to align two buttons in Bootstrap 4 navbar menu to the right side

My layout features two different menus in the navbar, as shown below: https://i.sstatic.net/hYanP.jpg The navbar menu collapses into two separate menu buttons, which is ideal. However, I am trying to align these buttons side by side on the right. How can ...

Tips for arranging items to appear in a dropdown menu instead of in a horizontal row on the navigation bar using Bootstrap 4

Sorry if this seems like a basic inquiry, but I'm still learning about bootstrap 4 and haven't had any luck finding the solution online. My issue involves a navigation bar with three columns: logo on the left, small menu in the center, and a log ...