One of the unique CSS properties found in the NextJS setup is the default 'zoom' property set to

Even though I already found a solution to the problem, I can't help but wonder what the author meant by it. Hopefully, my solution can help others who may encounter the same issue.

After installing the latest NextJS version 13.2.4 on my computer, I encountered a problem while styling a simple element - setting 100vh on a parent container that wraps a sign-in form and an image.

JSX Code Snippet

<section className={classes.section}> //applied height: 100vh here;
        <div className={classes['section__form']}>
          <SignInForm />
        </div>
        <div className={classes['section__img']}>
          <img src="/images/sign-in.jpg"></img>
        </div>
      </section>

Challenges Faced

  • The page height exceeded 100vh, causing an unwanted scroll bar.
  • Due to visual reasons, I needed to eliminate the unnecessary scrollbar.

In my globals.scss, I always include the following:

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

Despite these global settings, the page still displayed a scrollbar and extended beyond 100vh.

After much confusion, I discovered in Chrome dev tools that the body element had a default zoom property set.

 body {
 zoom: 1.1;
}

I couldn't locate where this property was coming from in my project files, but it seemed to get added automatically to the HTML document.

<style id="zoompage-zoomlevel-style" type="text/css">body { zoom: 1.1; }</style>

It appears to be buried deep within the NextJS setup files.

Solution

To override the existing zoom: 1.1 property, I added the following to my globals.scss:

body {
  zoom: 1 !important;
}

Without the !important rule, it wouldn't override the existing property.

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

I'm left wondering if this is a bug or if there's a more interesting reason behind it? 😉

Maciej


Permanent Solution

The Zoom Page WE Chrome plugin is the culprit behind this issue (adding the extra line to the HTML document). If you encounter similar problems, make sure to uninstall this plugin and the issue will be resolved.

Answer â„–1

I didn't have the "Zoom Page WE Chrome" extension mentioned and couldn't locate the `zoom` style anywhere. However, the "Solution" provided some direction on adjusting the zoom levels in Chrome directly. The exact fix remains a mystery, but I tried various steps such as zooming out, zooming back in, refreshing the browser, and repeating these actions multiple times. Eventually, the display returned to normal. :shrug:

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

Create a Mongoose model that includes a field containing an array of ObjectID's

I am encountering an issue with my object named company, which contains keys for name(String) and locations(Array). Within the locations key, I want to include a user-generated key called name, as well as a second key generated using ObjectID. However, I a ...

Transitioning from Webpack version 4 to version 5 resulted in a failure to detect certain styles

After migrating my React project to Webpack v5, I am facing an issue where none of my .scss files are being picked up when I run the project. I meticulously followed the guide on migrating webpack https://webpack.js.org/migrate/5/, updated all plugins and ...

How to Align the AppBar to the Left in MUI

Is there a way to position the AppBar on the left side of the screen using the React Material UI library from material-ui.com? I am working on a design that requires the global navigation to be displayed along the left side with a fixed position. Additiona ...

By default, apply the active class to the initial element in the list and update the active class upon clicking in Next.js

As a newcomer to React, I am struggling with setting the active class in my CSS file. I have two classes, btn and active. My goal is to assign the active class to the first button by default and then switch it to the currently clicked button when interacti ...

Why is VERCEL_URL displaying the development URL instead of the production URL on Vercel?

Recently I pushed my application to Vercel and inputted all the necessary ENV variables, such as VERCEL_URL which should reflect the production URL of the app. Strangely, despite setting it correctly, the console log continues to display the development UR ...

Chrome displays radio buttons with a white background that is not intended. Firefox, on the other hand

The radio buttons in Google Chrome are displaying an unwanted white background around the circle, which is not the intended behavior as seen in Firefox. Please refer to these images for comparison. For a direct example of the issue on the page, please vi ...

Implementing a persistent header on a WordPress site with Beaver Builder

My website URL is: . I have chosen to use beaver builder for building and designing my website. I am in need of a fixed header that can display over the top of the header image. Here is the code snippet that I currently have: <div id="header">html ...

Private routes in React navigates the user before the Firebase user information is fully loaded

I am struggling to set up a private route for 2 pages. The issue is that my private route checks if a user is logged in before firebase can update it. As a result, when the private route is accessed, the user will return null. This causes an immediate red ...

unable to insert logo into HTML

I am customizing an HTML template, but the dimensions of the logo in the template are smaller than my logo. Despite adding my logo to the template, it is not showing up. @media (max-width: 673px) { #logo { margin-left: 20px; } } #header #logo ...

Words next to picture

Can someone help me with aligning different images of varying widths but the same height inline with text next to each image? I tried to do it, but it doesn't look good on responsive screens. Any suggestions on how to fix this? And if there's a b ...

Ways to modify the header dimensions using CSS

I've been trying to figure this out, but I can't find a solution. For the structure, I'd like to use an h2 header to make it more semantic, but I want it to appear as an h5 header visually. However, CSS is not cooperating with this idea an ...

Display one div and conceal all others

Currently, I am implementing a toggle effect using fadeIn and fadeOut methods upon clicking a button. The JavaScript function I have created for this purpose is as follows: function showHide(divId){ if (document.getElementById(divID).style.display == ...

Animating the opacity of elements using jQuery and CSS

Trying to put together a fading slideshow with five slides that will loop back to the beginning. My code seems like it should do the trick, but there's something not quite right. <script type="text/javascript"> $(document).ready(function( ...

Establishing updated file path for resources in JavaScript based on environment

I'm currently facing an issue with my external Javascript file that uses the getScript() function to execute another JS file. Both files are located on static.mydomain.com, as I am trying to set up a Content Delivery Network (CDN) for the first time. ...

Redux thunk not resolving promise correctly with async/await

I'm facing an issue with my Axios thunk that is posting to an Express route using Sequelize. Although the route is successfully adding data to the database, the behavior of the action inside the React component is not as expected. Even though I am us ...

Can the values of state and props be changed?

Imagine a scenario where you have a react component in the form of a button that increases a value each time it is clicked. Consider the following example var Component = React.createClass({ getInitialState: function() { return {count: 0} ...

designing various containers and adjusting their divisions

I have a pop-up window that contains the code snippet below, defining a template within a "container": <form method="post" class="signin" action="#"> <div id='container'> <div> <div id="divFeeTitle"&g ...

The rendered typeface may vary from the specified font family

I've encountered an issue with a font on my website. I'm using DIN Regular True Type Font and declaring it as follows: @font-face { font-family: 'DINRegular'; src: url('../fonts/DINBek-Regular.ttf') format('truetype ...

Bootstrap Containers Misaligned

I have been developing a website with two containers, one on the left and one on the right. By executing the following HTML code, you can see the structure: <!DOCTYPE html> <html lang="en"> <head> <link rel=& ...

`Is it possible to output a nested array nested within a value (object element) in React.js?`

I am attempting to display a nested array (sublist) within the object element (value) from the state.list. Despite my efforts, I did not achieve the desired outcome. I have created two components called Orderlist and Item which handle the nested array and ...