Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

239
Views
React: MUI Typography inline spacing

Consider this code snippet:

<Typography className={classes.welcomeMessage} variant="h1">
              A <span className={classes.redText}>smart nation </span> approach
              to <span className={classes.redText}>safety.</span>
</Typography>

Essentially I want to have one sentence, but some of the words in that sentence are of red colour. redText and welcomeMessage contain the same properties except for the fact that the colour is different. However, the text comes up like this:

Asmart nationapproach tosafety.

I presume the span component is messing with the spacing. Is there an easy fix or ideal way of dealing with this?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

I tried it by the style and it's working perfectly, there should be some problem with your classes of styles, try this, it will work perfectly.

 <Typography style={{ color: "blue" }} variant="h1">
          A <span style={{ color: "red" }}>smart nation </span> approach to{" "}
          <span style={{ color: "red" }}>safety.</span>
        </Typography>
about 4 years ago · Juan Pablo Isaza Report

0

My suggestion is, on Typography you can try to use sx, so the code will like this:

<Typography sx={{ color: "blue" }} variant="h1">
  A <span style={{ color: "red" }}>smart nation </span> approach to{" "}
  <span style={{ color: "red" }}>safety.</span>
</Typography>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!