Using Bootstrap can cause CSS to become cluttered and disorganized

I created a basic burger button using HTML and CSS, everything was working perfectly until I decided to incorporate Bootstrap into my project for alignment purposes, which ended up causing conflicts with my existing CSS.

Instead of adding Bootstrap,

https://i.sstatic.net/ttW1J.png

After integrating Bootstrap:

https://i.sstatic.net/OCEuJ.png

I attempted to include Bootstrap before my CSS stylesheet in an effort to prevent it from overriding, but unfortunately, it did not resolve the issue.

Below is my code:

HTML

<button class="menuButton">
    <div class="buttonContainer">
        <span></span>
        <span id="midspan"></span>
        <span></span>
    </div>
</button>

CSS

.menuButton{
    margin: 0;
    padding: 0;
    border: none;
    width: 0vmin;   
    overflow: hidden;
    background-color: transparent;
    animation: buttonAnim 0.75s forwards;
    animation-delay: 0.5s;
    float: right;

}

@keyframes buttonAnim {
    100%{
        width:3vmin;
        right: 0;
    }
}

.menuButton span{
    width: 3vmin;
    height: 0.2vmin;
    margin-bottom: 0.5vmin;
    margin-top: 0.5vmin;
    display: block;
    background-color: coral;

}

.buttonContainer{
    width: 3vmin;
}

#midspan {
    transform: translate(1vmin, 0);
    transition: transform 0.3s ease;
}

.menuButton:hover {
    cursor: pointer;
}

.menuButton:hover #midspan{
    transform: translate(0);
}

Answer №1

The reason for this issue is due to the default bootstrap.css file overriding standard styles on different HTML elements.

If you are looking to implement a responsive grid layout without any additional styles, you can opt for including Bootstrap's CSS grid layout file bootstrap-grid.css or bootstrap-grid.min.css directly into your HTML code:

<link rel="stylesheet" href="css/bootstrap-grid.css">

You can access these files as part of their "compiled package" which is available for download here.

Note: The downloaded zip file contains multiple files, remember to use either bootstrap-grid.css or bootstrap-grid.min.css.

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

Tips for validating user input in AngularJS without using a form tag

Within a popup, I am displaying HTML content that has been copied from another div and shown in the popup. I need to validate this input field to ensure it is required, and display an error message below the input box. <!-- HTML code for changing zip c ...

ASP.NET Expandable Navigation Bar

I'm struggling to create a collapsible navigation bar for my website that works well on mobile devices. Here's the code for my navigation bar: <div style="padding-bottom: 50px;"> <header id="main-header"> <div ...

"Learn how to position a div element below the header div and above the footer div while maintaining full height in

Recently delving into the world of reactjs, I find myself facing a challenge with a page that contains 3 distinct blocks formed by divs. Have a look at the layout on my page: My Page This is the code snippet I have worked on: return ( <div> ...

When using the `display: table-cell` property on a div element, it does not automatically respect

How can I restrict the width of columns by defining a width attribute on the div.dcolumn DOM element to preserve the layout with overflowing cells? I want the content of any overflowing cell (like the 9px column) to be hidden while maintaining the specifie ...

A Guide to Retrieving the First Child Element's Text with Jquery and a Class Selector

I want to extract the text from the first child small element inside a dynamically generated div. The structure looks like this: <div class="NDateCount" style="display:inline-block"> <!--Issue to solve--> <small ...

Struggling to make the image adapt to mobile screen sizes, even after applying a width of 100% and

After spending countless hours researching online, I still can't figure out how to make the image responsive on mobile devices. On a computer screen, it looks fine: https://i.sstatic.net/sCPbA.png However, when I inspect the element and view the ima ...

What is the best way to horizontally center items within an unordered list (ul li) inside a div class

I'm attempting to center a horizontal lineup of small icons. In the Launchrock platform, users have the ability to customize all code. Unfortunately, I do not have access to their default CSS, but we are able to override it. <div class="LR-site-co ...

Navigating through directories in an HTML file

In my directory, the folders are named in uppercase letters and have the following structure: ONLINESHOP |-- index.html |-- COMPONENTS |-- CONFIG |-- TEMPLATES |-- CSS |-- main-style.css |-- CONTROLLERS |-- MODE ...

Having trouble understanding the odd behavior in IE7. Suddenly seeing a scrollbar appear when hovering

The webpage layout I am currently experiencing issues with can be found at the following link: When viewing this page in ie7 or ie8 Compatibility View mode, a strange horizontal scrollbar appears whenever I hover over one of the menu items. It seems that ...

What sets apart compressing test.min.css from compressing test.css?

Recently, I have transitioned to a new job role with a different employer. In my previous workplace, we utilized LESS and compiled it into a .css file before compressing it further into a .min.css file. However, in my current position, we also work with L ...

Challenges with implementing TailwindCSS classes in a Next.js application

I've encountered some issues in my nextJS app with utilizing certain TailwindCSS classes such as top, left, or drop-shadow. Even after attempting to update Tailwind from version 1.9.5 to 3.3.3, I have not seen any changes. I believe that I am import ...

When converting HTML to PDF using Dompdf, Font Awesome icons may not appear as expected

I am currently using Dompdf for exporting an HTML page to PDF. The issue I am facing is that when the HTML file contains Font Awesome icons, in the resulting PDF there are question marks instead of the icons. Below is a snippet of the HTML code: <!DOC ...

Placing information into a table cell using d3 library

Looking to insert text into a cell using d3? I have a function with the necessary code, which I am calling in the body of an HTML page. Here is a sample of the code that I am trying to get working: <!DOCTYPE html> <html> <head> <link ...

What impact do negative positioning have on CSS elements in terms of responsibility?

Just diving into CSS and I have a question to pose: Is it considered good practice to utilize negative positioning in CSS? Are there potential compatibility issues with browsers like IE7 and IE8? What is your suggestion? #example-bottom { position: relat ...

Achieving consistent text alignment in HTML and CSS without relying on tables

As I delve into the world of HTML and CSS, I've taken a traditional approach by crafting a login page complete with three input controls (two text inputs and one button). To ensure proper alignment of these elements, I initially turned to the trusty & ...

Conceal multiple divs at the same time based on their largest dimension

I am facing an issue with two divs, each containing two nested divs: https://i.sstatic.net/QFMiU.png <div class="hide"> <div> Variable size </div> <div> Text1 (also variable size) </div&g ...

Is there a way to get rid of the tiny black line beside the Instagram icon?

Here is the display on my website This is the code that was used I am struggling to identify the source of the small black "-" line next to the Instagram icon logo. ...

The inconsistent sizing and spacing between browsers is causing some strange issues for me

I can't shake this feeling that it should be so straightforward. I'll include screenshots from Chrome, Firefox, and IE 11 to illustrate. First things first, it's just a basic login form with email and password fields centered both verticall ...

"Maximizing battery life: Efficient video playback on iOS in low power

Summary: I am currently working on a website that features a video set as the background which autoplays. However, I have encountered an issue on iOS devices when "Low Power Mode" is activated - the video fails to play and instead displays a large "Play" i ...

Is there a way to conceal the parent element when the child element is hidden from view?

Wanting to remove the stars badge in the review section of a Shopify store when there are 0 reviews for the product. The goal is to have the badge appear automatically once a review is received. Here's the code snippet: HTML <div class="spr- ...