Having trouble with custom .CSS file/classes not importing into React Bootstrap application?

This is a follow-up from Attempting to adjust the position of my React button based on numerical values (##px) isn't effective?.

I am attempting to reposition a button on my webpage based on a specified value like ##px, but no matter what value I input, the button remains stationary at a few predetermined positions.

Upon inspecting the button element, it appears that the class btn-top-right is missing. However, the classes btn, btn-primary, and float-end are present in the button's styles/inspection.

Any insights? Dash.js:

import 'bootstrap/dist/css/bootstrap.min.css'; // Import the Bootstrap CSS file
import {Container, Row, Col } from 'react-bootstrap';
import init from './Svg'
import axios from 'axios'

import classes from './Dash.module.css'
const Dash = (props) => {
...
  render() {
    return (
      <div className="container">
        <button className="btn btn-primary btn-top-right float-end">CPU</button>
      </div>
    );
  }
...
}

and Dash.Module.css:

.btn-top-right {
    position: absolute;
    top: 2000px;
    right: 50000px;
  }

File/Directory Structure here (Image)

Answer №1

When it comes to priority, Bootstrap.min.css takes precedence over your file. However, you can override this by using the !important keyword.

.btn-top-right {
    position: absolute !important;
    top: 2000px !important;
    right: 50000px !important;
}

Answer №2

With the class being missing, it is possible that your code is being cached.

To resolve this issue, attempt a hard reload by pressing ctrl + shift + R or open your website in an incognito window.

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 adjusting the width of the scrollbar track (the line beneath the scrollbar)

How can I style a scrollbar to match this specific design? https://i.stack.imgur.com/KTUbL.png The desired design specifies that the width of -webkit-scrollbar-thumb should be 5px and the width of -webkit-scrollbar-track should be 2px. However, it is pro ...

Prevent the crawling of HTML segments by utilizing HTML-XSL parsing techniques

I am currently working with Watson Explorer FC 11.0.2 and I am facing a challenge in excluding certain HTML tags from the Watson crawlers. I am using an XSLT parser to extract metadata, title, and body from an HTML page located at the following path: "/h ...

An issue has been discovered where IE8 is unable to print an image within the :before pseudo

Is there a way to display an icon image before text without using HTML tags like <img> that may interfere with our JavaScript code if the structure of the HTML changes? I came up with the following code which successfully displays the icon on IE8 an ...

The drop-down menu keeps flickering instead of remaining open when clicked

I am facing an issue with a dropdown menu in my webpage. The menu is initially hidden, but should become visible when the list element containing it is clicked. I have written JavaScript code to add a class that changes the visibility property to visible u ...

The PDF format is experiencing compatibility issues when used with the CSS property for page breaks after:

My PDF with CSS page breaks is not functioning properly, as the pages are not breaking as intended. Removing position:absolute solves the issue but leaves space after each page. I suspect it may be a CSS problem, but I'm unsure. If the issue lies wit ...

Unable to transfer card from the top position in the screen

Utilizing Tailwind (flowbite) for the frontend of my project, I encountered an issue where the Navbar was overlapping the Card. I attempted using mt-8 to resolve the problem, but it did not yield significant changes. What adjustments should I make to achi ...

Issue with Chrome when using angled CSS gradient backgrounds

I'm encountering a problem with a CSS gradient background on a div that is set to 100% width and height. This issue only seems to be happening in Chrome. I have some content placed over the div, and when I hover over links within that div, the gradien ...

What is the best way to tidy up a function within a useEffect hook?

When updating state within a useEffect hook while using async/await syntax, I encountered an error regarding the cleanup function. I'm unsure how to properly utilize the cleanup function in this scenario. Error: Warning - A React state update was att ...

**Utilizing Bootstrap (v5) in Angular (v15) the Traditional Way**

I've successfully integrated Bootstrap with Angular by following the steps outlined in the ng-bootstrap.github.io documentation: ng new my-ng-bootstrap-app # Create angular app. Choose routing and SCSS options ng add @ng-bootstrap/ng-bootstrap # add b ...

Crafting a dynamic inline search form with Bootstrap

My goal is to replicate the design in this image: This is my current progress: ...

Implementation of internationalization into a JSON-formatted data file

I recently integrated i18n into my application and I'm facing a challenge with implementing the useTranslation(); function in my navbar data file. This file serves as the database for the page titles and tabs, and I'm unsure about how to proceed. ...

I'm attempting to utilize a basic webcam capture upload feature, but it seems that the upload function is not functioning properly

UPDATE: This is the complete code that I simply copied and pasted. <!DOCTYPE HTML> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <script language="JavaScript" type="text/javascrip ...

How to conceal hyperlink underline with css

This is some HTML Code I'm working with <a href="test.html"> <div class=" menubox mcolor1"> <h3>go to test page</h3> </div> </a> Here's the corresponding CSS: .menubox { height: 150px; width: 100%; ...

The div element is not being hidden even after the boolean for the hidden property is changed in

In my code, I have initialized a boolean variable called isStarted with a value of false. There are two div elements in the code snippet. The first one has a hidden attribute set to the value of isVisible: hidden={isVisible} And the second div has the hi ...

Display a snippet of each employee's biography along with a "Read More" button that will expand the content using Bootstrap, allowing users to learn more about each team

I have successfully developed a Google App Script that links to a Google Sheet serving as a database. The application iterates through each row, and I showcase each column as part of an employee bio page entry. ex. Picture | Name | Title | Phone | Email ...

"Unusual behavior: Material-UI Drawer fails to appear on Firefox browser

I am encountering an issue with a basic react application that incorporates Material-UI components. The menu drawer of the application does not show up in FF 60.4, however, it works perfectly in Chrome. When I manually change the state of the drawer in th ...

The navigation links in my React project are not appearing on the screen as expected

Hello everyone, I am relatively new to React and recently I have been attempting to utilize `react-router` in order to construct a Single Page Application. My goal is to link all the pages (such as Home, About, Login, etc) in the navigation bar using the & ...

Troubles encountered when loading pages into a div using ajax navigation

As someone new to the world of programming, I am embarking on the journey of creating a simple website for myself. Currently, my website consists of a header, navigation links, an image below the nav (to be updated later), and 3 content divs beneath that. ...

What is the best way to ensure that the buttons remain in place once they have been clicked to reveal a drop-down menu?

Is there a way to keep 3 buttons inline and prevent them from moving when clicked to open a submenu? Changing their positions results in them stacking on top of each other. Any help or suggestions would be greatly appreciated, thank you! Here is the code ...

Executing a function in React JS triggered by an event

Can someone help me figure out how to properly call a function from a React component within the same class? I am working with create-react-app. SomeFunction(){ return true; } handleClick(e){ SomeFunction(); // This part doesn't w ...