Is Bootstrap revolutionizing the world of flex-box layouts?

I'm currently in the process of creating a Simon game, and everything is going smoothly until I introduce Bootstrap into the mix. Suddenly, my "Simon board" starts acting strangely.

Here's the troublesome code:

HTML:

<div class="simon">
<button id="green" class="panel 1" type="button" disabled></button>
<button id="red" class="panel 2" type="button" disabled></button>
<button id="blue" class="panel 3" type="button" disabled></button>
<button id="yellow" class="panel 4" type="button" disabled></button>
</div>

CSS:

.panel {
  border: 2px solid white;
  opacity: .35;
  width: 200px;
  height: 200px;
  float: left;
  font-size: 22px;
  color: black;
}
.panel:hover {

  opacity: .55;
}

.simon {
  -webkit-box-shadow: 0px 0px 13px 7px rgba(0,0,0,0.58);
-moz-box-shadow: 0px 0px 13px 7px rgba(0,0,0,0.58);
box-shadow: 0px 0px 13px 7px rgba(0,0,0,0.58);
  margin: 0 auto;
  border: 5px solid black;
  border-radius 10px;
  display: flex;
  flex-wrap: wrap;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  overflow: hidden;
}

#green {
  background-color: green;
}
#red {
  background-color: red;
}
#yellow {
  background-color: yellow;
}
#blue {
  background-color: blue;
}

The issue might be related to the flex-wrap property conflicting with Bootstrap, although it shouldn't cause problems in this scenario. The "Simon" board looks perfectly fine without Bootstrap applied.

I'm not an expert in Bootstrap, but despite searching for answers, I can't seem to pinpoint why things are going off track.

Answer №1

Update the css styling :

.box_updated {
  border: 2px solid white;
  opacity: .35;
  width: 200px;
  height: 200px;
  float: left;
  font-size: 22px;
  color: black;
}
.box_updated:hover {

  opacity: .55;
}



<div class="container">
     <button id="green" class="box_updated 1" type="button" disabled></button>
     <button id="red" class="box_updated 2" type="button" disabled></button>
     <button id="blue" class="box_updated 3" type="button" disabled></button>
     <button id="yellow" class="box_updated 4" type="button" disabled></button>
</div>

Be mindful of Bootstrap's panel class as it may clash with your custom css styles.

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

Issue with Jquery addClass method in Firefox

I am encountering an issue with the jQuery addClass() function in Firefox where the class is not being added to the current element. Interestingly, this code works perfectly in Chrome and Safari (IE has not been tested). Here is the CSS snippet : $(doc ...

Only add table heading if there is available space, but refrain from doing so if it will disrupt the layout

My current challenge involves a table where I have successfully used white-space nowrap to prevent the heading text from wrapping. The issue arises when viewing the layout on smaller screen widths, as this nowrap setting causes the table to expand beyond ...

Form that adjusts input fields according to the selected input value

I am in need of creating a dynamic web form where users can select a category and based on their selection, new input fields will appear. I believe this involves using JavaScript, but my searches on GitHub and Stack Overflow have not yielded a suitable sol ...

Decrease the height of a div element from the top with the use of jQuery

My goal is to manipulate the height of the div #target when a specific event is triggered, either by reducing/increasing its height from the top or by hiding/showing its content. However, I'm struggling to find a solution to achieve this. The current ...

Leveraging jQuery to automatically fill in a time field while excluding other buttons

I've been working on using jQuery to automatically fill in a time input field. The functionality is working properly, but the time is also being applied to my other button. How can I make sure it only gets assigned to the time input field? I would re ...

Is there a child missing? If so, add a class

I need to add the class span.toggle if the parent element of li does not have a child ul element. click here to view on codepen Snippet of HTML: <html lang="en"> <head> <meta charset="UTF-8> <title>No Title</title>& ...

A concise way to write an else if statement in Javascript and jQuery

Is there a way to make this code more concise? It works perfectly fine, but it's too lengthy. Basically, the code involves two dropdown lists where the user selects options, and based on their selection, values appear in two textboxes. The catch is th ...

What is the best approach to ensure the navbar is responsive based on the viewport size?

I am working on creating a responsive webpage that will show different navigation based on the viewport size. Currently, I have written this JavaScript code: var shownav = document.getElementById('show-nav'); if (screen.width < "720"){ ...

Ways to align the `<ol>` number at the top vertically

I'm having trouble aligning my <ol> numbers vertically at the top of the list. I've created a sample on CodePen. ol { list-style-type: decimal-leading-zero; font-size: 11px; } a { font-size: 80px; tex ...

How can I translate these JQuery functions into vanilla JavaScript?

I am currently in the process of building a configurator using transparent images. The image configurator functions through a basic JQuery function: I have assigned each input element a data attribute called data-Image. This function identifies the data-Im ...

The main div on my website appears completely chaotic when viewed in IE versions 7 and 8

On my website, the main div appears floated left on some pages and right on others. In certain pages, it seems to be scattered all over in IE 7 and 8 - I didn't even bother checking in IE6. However, oddly enough, it displays perfectly in IE 6. I need ...

The footer is supposed to be at the bottom, but unfortunately, the clear float isn

Today seems to be a rough one without enough coffee, as I'm struggling to remember how to do this I am trying to achieve the following layout: header content float float footer The content section contains two floating elements. The problem is ...

revealing a particular field in jQuery during the validation process

Edit: Currently, I am utilizing the jquery validate plugin and have hidden all error messages initially. Upon checking a specific input field, my objective is to unhide the error message if it is invalid without causing error messages to appear in other f ...

Determining Text Color Based on Background Hue

Is it possible to create a div that dynamically changes text color based on the background color surrounding it? I want the text to switch between two different colors, with the font color being the opposite of the background color. For example, black text ...

Utilize pandas.read_html to extract image alt text from web pages

Can you extract the text from the img alt attribute using pandas.read_html? The webpage I am trying to scrape has replaced some text with images, and the original text is now stored in the alt attribute of those images. For example: <td> <div>. ...

What are the ways to incorporate the width property in @media queries within CSS?

I've been struggling to set the width inside @media in my code, but it's not working as expected. Here is what I have tried: mat-toolbar { app-toolbar-left { width: 35%; } app-toolbar-right { width: 22%; } } @me ...

creating a customized grid layout with Bootstrap 5

Is it possible to create a layout similar to the one shown in this image using Bootstrap 5? In addition, I would like to include an image inside every third item. How can I accomplish this with the Bootstrap grid system? ...

Tips for centering elements in an image caption

I need some help with separating an image and text within an image caption from each other. Currently, they are overlapping and I want them to be distinct. I attempted using inner div elements for the text and image separately, but it caused issues by brea ...

Display/conceal within a jQuery fixed navigation bar (center-aligned)

I am facing challenges with creating a sticky menu that shows/hides with a click button. Considering abandoning the show/hide feature altogether and rebuilding it from scratch in the future. Two major problems I have identified: How can I make the sho ...

Positioning a single column of iframes in the center

I have 6 graphs that I need to arrange in a grid with 2 rows and 3 columns. Each row should have one left-aligned graph, one center-aligned graph, and one right-aligned graph. However, the center-aligned graphs are not displaying correctly. Can someone hel ...