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

174
Views
Styling a react component in styled-component

I am trying to align the component in the center. But I am unable to do so.

Component snippet:

<Grid item xs={12}>
              <Box marginTop={2} marginBottom={2} display="flex">
                <Box width="100%">
                  <Divider />
                </Box>
                <Box width="100%">
                  <OrLabel>OR</OrLabel>
                </Box>
                <Box width="50%">
                  <Divider />
                </Box>
              </Box>
            </Grid>

component styling:

export const OrLabel = styled.span`
  position: absolute;
  margin-top: -10px;
  margin-left: -10px;
`;

enter image description here

I tried the position: center in the styled-component, but it also giving the same result. How could I move the "OR" to the center?

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

0

please try it:

 <Box style{{display:"flex",alignItem:"center",justyfyContent:"center"}} width="100%"> <OrLabel>OR</OrLabel> </Box>
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!