Trouble with Font Display in React App

Currently, I have implemented a process to import fonts from Google Fonts and have successfully applied these fonts to all elements on the index page.

However, there seems to be an issue with applying these fonts correctly.

Within index.html:

<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">

In index.css:

.body {
  margin: 0;
  padding: 0;
  font-family: 'Press Start 2P'; }

Answer №1

Check out how this functions, maybe you're attempting to make changes in the body tag, simply replace .body with body

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
body {
  margin: 0;
  padding: 0;
  font-family: 'Press Start 2P', cursive;
}
Hello World!

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

React-Redux-Saga: Only plain objects are allowed for actions. Consider using custom middleware for handling asynchronous actions

Struggling to integrate redux-saga into my react app, I keep encountering this error: Actions must be plain objects. Use custom middleware for async actions. The error appears at: 15 | changeText = event => { > 16 | this.props.chan ...

Node-modules CSS

In my React application, I am utilizing CSS modules. By configuring modules:true in my webpack.config.js, I can successfully apply styles from files within my src folder. However, when importing components from node-modules, the corresponding CSS is not be ...

ReactJS safeguarded route redirection/refresh obstacle

Utilizing react and react-router-dom: import React from 'react'; import { Switch, Route, Redirect } from 'react-router-dom'; To secure a route with the following: Router const Router = () => { return ( <Switch> ...

Is it feasible to swap out the cursor for a personalized image of my choice?

Can I replace the cursor icon with my own custom image that I created in Photoshop? I have seen websites with custom cursor images, so I know it is possible. But how do I do it and is it a standard approach? Will it work across all browsers? ...

How to automatically set a pre-selected value in a ReactJS Material-UI Select Component

Is there a built-in event in Material-UI for detecting changes in pre-selected values within a Select component? Take, for instance, this Select component with three options: https://i.stack.imgur.com/CKJ5C.png I am looking for an event that triggers wh ...

Tips for personalizing the default styles in @tailwindcss/forms

Utilizing the @tailwindcss/forms will result in a similar style to Unstyled on the specified site. The checkbox is meant to resemble Simple on the designated site. Currently, an unwanted border appears when pressing down on the checkbox, resembling the ...

What is the method for ensuring that a Material UI TextField matches the width of its content?

After reviewing the documentation, it seems that Material UI only offers options for full-width or fixed width elements. However, I am looking for a way to set the width of an element based on its content. For example, if it's a text box containing a ...

What is the best way to showcase images along with their captions in a horizontal layout

I am facing an issue with displaying the last four images at the end of the page horizontally. When there is no caption, I can use the display:flex property to achieve this layout, but as soon as I add a caption, the images are displayed vertically instead ...

Explore through the absolute object in the console by scrolling down, similar to a

I have a collection of commands that are displayed in a console-like format using Angular. When a new command is added, it appears at the bottom and the overflow moves upwards to accommodate the new content. However, I am facing an issue where I can no lon ...

How can I make an image appear in React when it is

I am currently looking to incorporate an image every time I click incrementally. I attempted the solution below, which is in the commented-out section. BallonTest = () => { const [money, setMoney] = useState(0); const [bank, setBank] = useState(0); ...

Can you provide guidance on how to perfectly align a div within another div both vertically and horizontally?

Similar Inquiry: Method to center an image both vertically and horizontally within a larger div I'm working on positioning a div that is 300px in both height and length. My goal is to have another div inside it, sized at 100px for both dimensions ...

There is a potential for an object to be 'undefined' in TypeScript

My current project involves making a GET request from a mockAPI with the following structure: "usuarios": [ { "nome": "foo bar", "cpf": "213.123.123-45", "email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cf ...

Tips for confirming each form stage in material ui stepper?

This is a typical material-ui stepper displayed below. export default function HorizontalLinearStepper() { const classes = useStyles(); const [activeStep, setActiveStep] = React.useState(0); const [skipped, setSkipped] = React.useState(new ...

Incorporated React component from Rails-assets.org into a Rails application

I have been trying to incorporate a react component from rails-assets.org into my Rails application. Currently, I am using the react-rails gem to write react view in my application. Now, I want to use other react components such as react-router, react-sel ...

The form submits immediately after jquery is activated

One challenge I'm facing involves multiple forms on a single page being submitted using jQuery. Currently, I have the following code snippet: $("form").submit(function (e) { // Submit form via Ajax }); The problem arises when the form is only s ...

Challenge with MUI V5 and Emotion Theme in Jest/RTL testing Environment

Currently, I am utilizing MUI V5 and Emotion for styling purposes. The following code functions seamlessly in Storybook; however, I am perplexed as to why the theme is not being injected into the Emotion styling. I assumed that the ThemeProvider would take ...

Safari browser problem with CSS transformation

Encountering an issue on iOS devices While implementing a rotating card using the code below, everything works smoothly on various devices except for Safari browser. There seems to be a problem with both the icon and the card itself. The complication arise ...

Tips on customizing the color of the arrow in an mdc-select dropdown menu?

I'm struggling to modify the default purple color of the dropdown arrow in an mdc-select: https://i.sstatic.net/DdDEv.png None of the sass mixins seem to be effective in making the change. Any suggestions on how this can be achieved? Here are my a ...

Pattern matching technique to capture content within a span tag

In C#, I am looking to extract the value "nHKS8cG006" from the following code snippet: "Content from Eikon: <span class="tr-pnac" id="x2">ID:nHKS8cG006</span>" The text "Content from Eikon" should be part of the regular expression, and the cla ...

Attempting to showcase two lines within a single row on an html page

Currently, I am working on a project involving ASP MVC and Bootstrap where I need to display the regulation of a transformer in a specific format. This representation can be seen in the image below: https://i.sstatic.net/VzVcA.png My attempt to achieve t ...