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

131
Views
Why is one HTML component style affecting the other components?

I'm using React and have a page with 2 components:

return (
 <div>
   <NewNavbar />
   <Row />
 </div>

)

The NewNavbar component looks as follows:

const App = () => (
  <Navbar bg="light" expand="lg">
    <Container>
      <Navbar.Brand href="#home">React-Bootstrap</Navbar.Brand>
      <Navbar.Toggle aria-controls="basic-navbar-nav" />
      <Navbar.Collapse id="basic-navbar-nav">
        <Nav className="me-auto">
          <Nav.Link href="#/questions">Questions</Nav.Link>
          <NavDropdown title="Dropdown" id="basic-nav-dropdown">
            <NavDropdown.Item href="#action/3.1">Action</NavDropdown.Item>
            <NavDropdown.Item href="#action/3.2">
              Another action
            </NavDropdown.Item>
            <NavDropdown.Item href="#action/3.3">Something</NavDropdown.Item>
            <NavDropdown.Divider />
            <NavDropdown.Item href="#action/3.4">
              Separated link
            </NavDropdown.Item>
          </NavDropdown>
        </Nav>
      </Navbar.Collapse>
    </Container>
  </Navbar>
);

export default App;

For some reason, when I return the <NewNavbar>, the <Row> component's styling is also changing. How do I make it so that the NewNavbar styling doesn't affect other components?

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

0

There can be many reasons for this issue like

  • Using same className in both the component
  • using global stylesheet ( eg. index.css ) to style components
  • Both the components are of the same type

To fix this issue you can give both the component diffrent className, if both comoponents are of the same type use seprate stylesheet or inline styles to style the components diffrently and avoid using global stylesheet to style components

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!