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

217
Views
¿Por qué el color del texto no funciona en el proyecto Tailwind css + next.js?

Tengo un proyecto Next js con viento de cola. Por alguna razón, ciertos colores funcionan mientras que otros no. Por ejemplo:

 {title ? <div className={`text-2xl mt-2 mb-2 ${title==='Valid Url!' ? 'text-blue-400' : 'text-red-400'}`}>{title}</div> : null}

Cuando ejecuto el código y el "título" no es nulo, text-blue-400 en realidad cambia el color del texto. Pero cuando lo ejecuto con "título" como texto nulo-rojo-400 en realidad no cambia el color del texto. solo queda negro. ¡Es realmente extraño porque si uso text-red-500 funciona!

este es mi tailwind.config.js

 module.exports = { mode: 'jit', purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'], darkMode: false, // or 'media' or 'class' theme: { extend: { width: { '92': '23rem', '112': '28rem', '128': '32rem', '160': '40rem', '192': '48rem', '224': '56rem', '256': '64rem', '288': '72rem', '320': '80rem' }, minWidth: { '20': '5rem', '400': '400px' } }, }, variants: { extend: {}, }, plugins: [], }

aquí están las importaciones en _app.js

 import 'tailwindcss/tailwind.css'; import '../styles/globals.css'; import 'react-datepicker/dist/react-datepicker.css'

y finalmente esto es globals.css

 html, body { padding: 0; margin: 0; font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; } /* a { color: inherit; text-decoration: none; } * { box-sizing: border-box; }*/ .tooltip { display: none; position: absolute; } .has-tooltip:hover .tooltip { display: block; z-index:50; }

Si alguien puede ayudar, se lo agradecería mucho. No sé por qué esto no funciona.

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

0

A veces es necesario detener y reiniciar al instalar Tilwindcss.

¿Intentaste detenerlo y ejecutarlo de nuevo?


además, si no necesita el segundo argumento del operador condicional , puede usar solo un doble "&&"

 <> {title && <div className={`text-2xl mt-2 mb-2 ${title==='Valid Url!' ? 'text-blue-400' : 'text-red-400'}`}>{title}</div> } </>
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!