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

224
Visualizações
how to use start and end in css position reletive or others?

I'm trying to use multiple languages in my nextjs project and MUI library, and I m setting my body element of my project direction using locale.

  const App = (props: MyAppProps) => {
    const {
        Component,
        emotionCache = clientSideEmotionCache,
        pageProps,
    } = props;

    const router = useRouter()
    const { locale } = router;
    

    return (
        <CacheProvider value={emotionCache}>
            <ThemeProvider theme={getTheme(theme)}>
                <CssBaseline />
                <GlobalStyles styles={{
                    body:{
                    backgroundColor:getTheme(theme).palette.Background.background,
                    direction:locale==="fa"?"rtl":"ltr"
                    }
                }}/>
                <Component {...pageProps} />
            </ThemeProvider>
        </CacheProvider>
    );
};

and that works fine with the text-align property but I have a problem with positioning my elements because there are right, left, bottom, top properties in positioning, and there isn't a start and end property. for example:

 width:50px;
 height:50px
 position: relative;
 left:2px

my element with the position above, I want to position 2px from left in RTL directional language like Persian but I want to position it 2px from right in LTR directional language such as the English Language. it is usually done with start and end properties but in css i dont know because there isnt sutch a thing in position property.so my question is how can I position the elements base of start and end?

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

0

display Put your element in flex mode and use the justify-content, ... capabilities. go to enter link description here

about 4 years ago · Juan Pablo Isaza Relatório

0

I am unable to understand your code, But question is related to CSS that's why I am providing you some idea. Let's you have a element <div id="element" class="{{ direction:locale==='fa'?'rtl':'ltr' }}">Your contents</div>

Now, put this css in your style page->

#element.rtl {
 left: 2px;
}
#element.ltr {
 right: 2px;
}

Hope this will help you. If not, comment here.

about 4 years ago · Juan Pablo Isaza Relatório

0

You have to set position relative to div element and lest or right position to nested div element.

Structure your HTML similar to this:

<div id="container">
  <div class="top left"></div>
  <div class="top right"></div>
</div>

CSS

#container {
  position: relative;
}

#container > * {
  position: absolute;
}

.left {
  left: 2px;
}

.right {
  right: 2px;
}
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