The CSS styling fails to load for the second container on NextJS

I am facing a problem with styling two div containers using CSS imported from a separate file. The first style is applied successfully using the className property, but the second one is not working as expected. Despite having defined the 'sales' class in the CSS file, it is not being picked up.

dashboard.js

import HomeSalesmanStyles from '../../../styles/SalesmanHome.module.css';

const HomeSalesman = ({name}) => {
  return(
    <>
      <div className={HomeSalesmanStyles.container}>
        <h4>
          Hello, {name} 👋 
        </h4>
      </div>
      <div className={HomeSalesmanStyles.sales}>
          Hello
      </div>
    </>
  )
};

export default HomeSalesman;

SalesmanHome.module.css

.container {
  display: flex;
  justify-content: center;
  margin-top: 5%;
};
.sales {
  display: flex;
  justify-content: center;
  width: 100px;
  background-color: red;
}

Any suggestions on how to resolve this issue?

----------- Edit ------------ The problem was due to an incorrect CSS module name import! Once corrected to the right file, everything worked perfectly.

Answer â„–1

You might have encountered a syntax issue in the CSS code. Make sure to avoid adding unnecessary semicolons after rules.

.section {
  display: flex;
  justify-content: center;
  margin-top: 5%;
} /* <- do not include a semicolon here */
.products {
  display: flex;
  justify-content: center;
  width: 120px;
  background-color: blue;
}
<div class="section">
  <h4>
    Welcome, {name} 👋 
  </h4>
  </div>
  <div class="products">
      Greetings
  </div>

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

Bootstrap's Vertical Margin Concept

Is there a way to include margin or a line similar to the image below? [![Please refer to the accompanying image][1]][1] ...

Is there a way to get a div to scroll its content inside another div with a max-height of (px)? I've tried setting the height in percentage but the scroll doesn't seem to work

<div style="max-height:450px; overflow: auto;"> <table id="improvementTbl" class="table table-hover table-bordered table-striped nowrap" cellpadding="0" cellspacing="0"> <tbody class ...

"Customizing the color of the arrow in Bootstrap tooltips

Trying to customize tooltips in twitter-bootstrap, I set the template option of the tooltip with inline styles to achieve red tooltips instead of the default black color: $(document).ready(function(){ options = { container: 'body&ap ...

Managing excess space in a flexbox: Tips for handling events

Is there a way to manage events triggered by clicking on the violet-colored space around elements? I tried adding a general onclick event to the container, but it seems to be interfering with the individual item behaviors that already have their own intern ...

The onclick function only triggers after the second click

I have an issue with my image view onclick function code. Currently, the code works perfectly but only when I click for the second time. I am not sure what the problem is and would appreciate any help in fixing it. Below is the code snippet: <script ...

When I try to start the editor with HTML content using the convertFromHTML method, I encounter an error stating that

I am encountering an error when trying to initialize my Editor state with a HTML markup. at renderToString (/home/al/Documents/node/admin-next/node_modules/react-dom/cjs/react-dom-server.node.development.js:3988:27) at render (/home/al/Documents/node/admin ...

Exploring the latest features in Next.js version 13, implementing MUI, optimizing with transpilePackages,

My current project involves utilizing both Turborepo and MUI within a monorepository setup. To enhance performance, I am integrating Next.js 13 and exploring optimization techniques. Recently, I came across an article that discusses leveraging the new tran ...

Position a div directly beneath the header

I have recently added a widget area below the header on my website, and I am facing an issue with centering it just under the logo. I've attempted to use display: block and margin:0 auto, as well as text-align: center on the #header-sidebar in the CS ...

Get the first child element using Selenium with Python

I'm currently facing an issue while attempting to scrape prices from a website using Python. The problem arises when the code for the css_selector or xpath of the first search result keeps fluctuating. For example, after making a search query, the cs ...

The fixed header column doesn't remain sticky

I am working on fixing the first column in my table to remain static on mobile devices so that users can easily identify the data they are viewing when scrolling. While the td elements in the table work perfectly as intended, the column header continues to ...

Placing CSS elements in an absolute position over dynamic heights

I am facing a challenge with positioning two divs inside a parent div. My goal is to have the first div positioned absolutely at bottom:0 of the parent div, while the second div should always be on top of the first one. The issue arises because the height ...

Connecting CSS Style Sheet to JSP Page

I'm facing an issue with linking a CSS file located in my WEB-INF folder to a JSP page. In the JSP page, I have specified the location of the CSS file as follows: <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/WEB- ...

Passing image source as a Property in React JS: A Complete Guide

Can you please explain how to send the image source as a property (props) to a child component? ...

How can you manage local data storage in a Next.js app after fetching data from Firestore?

In the process of developing a react e-commerce application with a Firestore database, I encounter a dilemma. Upon app loading, it retrieves the initial 50 products (each as a Firestore doc) and displays them on product cards. The issue at hand is determin ...

What causes the text-align property to function in varying ways across different tags?

Can you explain why the text-align property behaves differently on different tags? In two cases, I am trying to center my text. In the first case, I use a parent div tag with an anchor tag inside. When I need to center align, I apply the property to the p ...

Can a browser be instructed on the specific order to download images?

My website includes a fullscreen image slider with approximately 20 images, each around 250kb in size. Due to the large file sizes, I have configured the slider not to start until the first 4 images are downloaded. However, when viewed in the latest versio ...

position an image directly on top of the table with a slight transparency

I'm looking to display the image attached above a table with some transparency. The challenge I'm facing in my current code is that the image is appearing below the table instead of across it. Additionally, I need the image to be wrapped in a div ...

Tips for displaying logs generated from getStatic functions in Next.js when running in production mode (including Vercel)

After adding console.log() statements to my getStaticProps functions, I am unable to locate where the logs are being stored. These logs are crucial for identifying and resolving static generation issues on certain pages. Where can I access or save these lo ...

What is the solution to fixing the EPERM error that occurs while trying to run npx create-next-app@latest?

When I attempted to run the create app for React, I encountered an error that stated "Aborting installation. Unexpected error. Please report it as a bug: [Error: EPERM: operation not permitted, mkdir 'D:\React\vita'] { errno: -4048, cod ...

The issue with the background-size: contain property not functioning properly across different browsers is causing

Hey there! I have created a gallery using a DIV element with a changing background image depending on the preview image or text that is clicked on. Since the pictures in the gallery are of different sizes, I decided to use "background-size: contain". The ...