The font style in React appears distinct from that of Bootstrap

I am looking to create a login page using both bootstrap and react. I found the perfect style on the official website. To implement this, I included all the necessary bootstrap and CSS files in my index.html file:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="theme-color" content="#000000">
    <!--
      manifest.json provides metadata used when your web app is added to the
      homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
    -->
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json">
    <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">

    <link href="all.css" rel="stylesheet">
    <link href="autorization.css" rel="stylesheet">
    <link href="bootstrap.min.css" rel="stylesheet">

    <title>React App</title>
  </head>
  <body>
    <div id="root"></div>
  </body>
  <script src="bootstrap.bundle.min.js"></script>
  <script src="jquery.min.js"></script>
</html>

However, upon testing, I noticed that the result looked different than expected compared to opening it as a regular HTML file. The font appeared to be off.

Desired outcome:

https://i.sstatic.net/2lgab.png

Actual outcome:

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

I'm puzzled as to why this discrepancy exists, especially since I didn't make any changes to the CSS files...

Answer №1

The problem might lie within the index.js file. It seems that you have deleted the line where you imported the index.css file.

To resolve this issue, simply remove the following line from the index.js file:

import './index.css';

Answer №2

It's possible that another CSS file is being loaded after bootstrap, which could be overwriting CSS style rules. Make sure to check the console or browser to see which styles are being applied from which file first.

Answer №3

Stand out by using the following powerful technique:

For instance, employ this code snippet:

font-family: 'Lilita One'!important;

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

Displaying DjangoCKEditor within a React CKEditor

Is it possible to display the RichTextField from Django CKEditor using CKEditor from ckeditor5-react? In my understanding, we can manually render a Django field as long as the name and id match the form field. However, I am unsure how to reproduce Django ...

Utilizing React to adapt to varying HTML layouts while maintaining consistent component usage

How can I create an App with two different views for mobile and desktop without relying solely on CSS Media Queries? I have been searching for guidance but so far haven't found a solution. Any advice or direction on where to find documentation or oth ...

Animating an image into a Vue.js div

Is it possible to create a dynamic image animation using Vue.js? I am looking to create an interactive "Add to Cart" experience where when a user clicks on the button, the product's image smoothly glides over to the shopping cart icon before fading a ...

Next.js13 encounters an undefined value while trying to access environment variables with a dynamic key

In my current project with Next.js version 13, I have an interesting challenge. I am trying to retrieve data from an .env file using a dynamic key. The page type is determined by a client component, for example - let's say it's "HOME". I am attem ...

Experiencing too many redirects - Express/node deployment on Heroku

Recently, while using Express/node on Heroku, I encountered an error message stating "Redirected you too many times" or "net::ERR_TOO_MANY_REDIRECTS" in the console. As someone new to Express, I attempted to set up a redirect so that all http requests on ...

Arranging the Logo and hamburger menu for optimal visibility

I am having trouble aligning a CSS hamburger menu next to my logo. I have placed both the CSS hamburger and the logo in the header. Although I was able to float the logo to the right, it is not on the same line as the menu. After the header, I would like ...

What is the best way to align the Logo and text in a material-ui Appbar?

I am using Material-UI Appbar and trying to center my logo and title in the middle, but I haven't been successful yet. Here is my code, can you please help me identify what's wrong? You can also try running the code in codesandbox: https://code ...

What are the solutions to repair a triple drop-down menu?

I am struggling with the code below which contains numbers inside the values: What I need is to modify all instances of the following codes: <option value="1" class="sub_1"> To look like this: <option value="" id="1" class="sub_1"> Basical ...

Instead of using a hardcoded value, opt for event.target.name when updating the state in a nested array

When working with a dynamically added nested array in my state, I encounter the challenge of not knowing the key/name of the array. This lack of knowledge makes it difficult to add, update, iterate, or remove items within the array. The problem lies in fun ...

React JS Material UI disabled button under control

I am looking for some guidance. I am working on a feature where I need to disable a button conditionally. The idea is that if something is selected from my table, then the button should be available; otherwise, it should be disabled. MUI requires a boolean ...

Having trouble signing out in Nextjs?

As a newcomer to Reactjs and Nextjs, I am currently working on developing an admin panel. To handle the login functionality, I have implemented the following code in my index.js/login page using session storage: const data = { name: email, password: pa ...

Looking for a straightforward method to handle local state using Apollo Client 2.5 in React? Wondering what the counterpart to 'client.writeData' is when it comes to reading data?

Exploring the local state management capabilities of Apollo Client 2.5 has been quite a challenge for me. While I found Apollo Server easy to grasp, this aspect is proving to be more complex. I have a basic understanding of setting up local resolvers and ...

What is the best way to serve a .ttf file in node.js with the http and fs libraries?

I am running a basic node server and I have a CSS file that is trying to load a font from the server: @font-face{ font-family: 'NiagaraSolid-Reg'; src: url('http://localhost:1111/NIAGSOL.TTF'); } This is my attempt at servin ...

Ways to make JavaScript cycle through a set of images

I'm having trouble trying to set up a code that will rotate multiple images in a cycle for an image gallery I'm working on. So far, I've only been able to get one image to cycle through successfully. Any help or suggestions would be greatly ...

Using jQuery's .html function to insert images

I have a unique counter that counts in currencies, such as Yen and Euro. Each number, as well as the currency sign and separator, are all displayed on the webpage using custom-designed icons. I utilize the display: flex; property in my container div and ap ...

Integrating force refresh functionality into a React application

I currently have a React application running on an apache/PHP server. The React app is set to load on the home path by configuring PHP to load index.html at the / route, which then loads the React app. index.html // .... <div id="react-hook"></ ...

Tips for displaying the content of a personalized navigation tab using jQuery

I successfully created custom tabs using JQuery. Here is the code for my custom tabs: <div class="row"> <div class="col-4 master-advanced-left-tab master-advanced-left-tab-active"> <p>Item 1</p> </div> < ...

Creating inner borders on a pie chart with HTML and CSS: A step-by-step guide

After putting my coding skills to the test, I successfully crafted a stunning pie chart using only HTML and CSS. https://i.sstatic.net/5xCbl.png Here's the code snippet I tinkered with: HTML - <div class="pie-chart"></div> CS ...

What is the best way to create a @mixin incorporating variables to easily reference breakpoints using custom aliases?

Currently in the process of constructing a website using SASS coding, I have created several @mixins for Media Queries that will be utilized later with the @include directive. The structure of these mixins is as follows: _standards.sass // Media queries @ ...

Steps for displaying a bootstrap modal in alignment with the triggering button's position

Recently diving into the world of bootstrap and AngularJs has been quite the learning experience for me. One challenge I encountered was trying to implement a bootstrap modal dialog box to show additional details within a table column. My goal was to hav ...