Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

208
Visualizações
Unable to apply media specific styling to the error page that appears when Javascript is Disabled

I have a website and I want to add a custom error page when javascript is disabled. I added a component inside inside _document.js

<body>
    <noscript>
        <ErrorPage />
    </noscript>
</body>

Then that page is defined like this

function ErrorPage() {

    const requiredMsg = 'Javascript Required'
    const errorText = 'We’re sorry, but the page does not work without JavaScript enabled. Please enable JavaScript on your browser.'

    return (
        <div style={{ width: '100%', textAlign: 'center' }} >
            <img style={{ width: '100%' }} src={ 'img.svg' } />
            <Typography component='h1' style={{ fontFamily: 'lato, sans-serif', color: '#1074C3' }}>{requiredMsg}</Typography>
        </div>
    )
}

export default ErrorPage

It looks good, but I need to add some media specific styling and elements to the page. Like it needs to take up entire space in mobile, while in desktop, it should just occupy the middle 200 px height, and rest should have a faded background. How is that possible? Can this be achieved?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I was able to achieve this by placing the styles within inside _document

 <Html>
                <noscript>
                    <style>{`
                        div.errorPage {
                            background-color: rgba(0,0,0,0.3);
                        }
                       
                        /* This is mobile */
                        @media (max-width:600px) {
                            div.errorPage {
                                background-color: none;
                                width: 100%;
                                text-align: center;
                                height: auto;
                            }
                        }
                    `}</style>
                </noscript>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda