Removing container fluid padding specifically in React-Bootstrap for Reactjs


Subrato Patnaik

I'm practicing grid layout in react-bootstrap. But when I try to clear the filling of the container liquid it gets stuck. We can do this in regular bootstrap by overriding the container fluid class and making padding 0 important.

.container-fluid {
  padding: 0 !important;
}

I tried this approach and it works fine, but I don't want to use it !importantbecause I might have a lot of container fluids in my app later.

<Container fluid>
      <Row noGutters>
        <Col lg={6} md={6} xs={12}>
          <div style={{ background: "red" }}>hello i am subrato</div>
        </Col>
        <Col lg={6} md={6} xs={12}>
          <div style={{ background: "blue" }}>I new to react-bootstrap</div>
        </Col>
      </Row>
      <Row noGutters>
        <Col xs={12} md={8}>
          <div style={{ background: "red" }}>hello i am subrato</div>
        </Col>
        <Col xs={12} md={4}>
          <div style={{ background: "blue" }}>I new to react-bootstrap</div>
        </Col>
      </Row>
</Container>

See my output here

enter image description here

How to specifically select that container in react-bootstrap?

Subrato Patnaik

I have added a className="p-0"to my container liquid and it works great. If we want to use the regular bootstrap, we can use it by specifying the class in className. The main reason I use inline styles is that inline styles are more specific than both inner and outer styles .

Like inline-style > internal style > external stylein terms of specificity.

<Container fluid={true} className="p-0">
      <Row noGutters>
        <Col lg={6} md={6} xs={12}>
          <div style={{ background: "red" }}>hello i am subrato</div>
        </Col>
        <Col lg={6} md={6} xs={12}>
          <div style={{ background: "blue" }}>I new to react-bootstrap</div>
        </Col>
      </Row>
</Container>

Avoid !importantusing in your application. Use !importantthe position of the selection element specifically. E.g

div p span{
 color: red !important;
}

span{
color: blue;
}

The text inside div p spanwill be red, and the text inside will spanbe blue (here the CSS for the span won't be overridden due to div p spanpeculiarities ).

Related


container-fluid and side padding with Bootstrap 3

Andrew Koper I want my page's content to take up the full width of the screen with a little padding on the right and left and be fluid, but when I wrap my div.row and div.col-md-x in a <div class="container-fluid"> the page's content touches the sides of the s

Bootstrap Container Fluid Carousel

Sonia Maklouf I was surprised, I thought using container fluid would give me a full width carousel, but it doesn't. It has a padding of around 15 px, so I added a new class remove-padding so that there is no padding, but it didn't work. Any ideas for a carouse

Bootstrap container fluid vertical scrolling

User 3599233 I've found many answers to this question, but none seem to work for me. I am using Bootstrap 3.3.7. Here is my code: <div class="container-fluid"> <div class="row"> <div class="col-md-2"> <div class="sectionLeft"> Sidebar Conte

Bootstrap - img as container fluid background

Lucas Tilsch I want the title of the page, which contains the greeting, and has an image as the background. How do I achieve the image is the background of the container fluid, but it scales with the text so it's fully responsive. That's what the title says. <

Bootstrap - img as container fluid background

Lucas Tilsch I want the title of the page, which contains the greeting, and has an image as the background. How do I achieve the image is the background of the container fluid, but it scales with the text so it's fully responsive. That's what the title says. <

Bootstrap - img as container fluid background

Lucas Tilsch I want the title of the page, which contains the greeting, and has an image as the background. How do I achieve the image is the background of the container fluid, but it scales with the text so it's fully responsive. That's what the title says. <

Bootstrap - img as container fluid background

Lucas Tilsch I want the title of the page, which contains the greeting, and has an image as the background. How do I achieve the image is the background of the container fluid, but it scales with the text so it's fully responsive. That's what the title says. <

Bootstrap - img as container fluid background

Lucas Tilsch I want the title of the page, which contains the greeting, and has an image as the background. How do I achieve the image is the background of the container fluid, but it scales with the text so it's fully responsive. That's what the title says. <

Bootstrap - img as container fluid background

Lucas Tilsch I want the title of the page, which contains the greeting, and has an image as the background. How do I achieve the image is the background of the container fluid, but it scales with the text so it's fully responsive. That's what the title says. <

Bootstrap - img as container fluid background

Lucas Tilsch I want the title of the page, which contains the greeting, and has an image as the background. How do I achieve the image is the background of the container fluid, but it scales with the text so it's fully responsive. That's what the title says. <

Bootstrap - img as container fluid background

Lucas Tilsch I want the title of the page, which contains the greeting, and has an image as the background. How do I achieve the image is the background of the container fluid, but it scales with the text so it's fully responsive. That's what the title says. <

Bootstrap 3 add container fluid inside container?

little cousin I have a normal container and I want to add a full width container fluid inside the container so that the container is "full view" across the entire screen. I tried that, but it doesn't have the full width. <div class="container"> <div class="co

BootStrap 3 container inside container fluid

ndd Below is the layout I'm doing with BootStrap3. I have an example with limited layout set up for this problem at http://jsfiddle.net/s7Rwj/4 I'm having a hard time setting the title. I'm using container fluid width, so my header is 100% wide, but the questi

bootstrap container fluid - clear margins correctly (overflow)

Knicks How to remove boostrap container-fluidclass and all margins in its row ? .container-fluid { padding: 0;} This basically does what I want, but adds 20px of overflow. So I should do this: body, html { overflow-x: hidden; } do something.container-fluid >

Container Fluid and Side Pads with Bootstrap 3

Andrew Copper I want the content of my page to take up the entire width of the screen with small margins on the right and left, to be fluid, but when I wrap my page div.rowand div.col-md-xthe <div class="container-fluid">content touches the sides of the screen

Bootstrap 3 fluid container with center content

George I'm sure this might be simple, but I haven't figured it out yet. As with non-fluid containers, how can I create a full-screen fluid container and keep the content (including navigation) in the center of the page? I just want the top nav/header backgroun

Bootstrap container fluid is not the full width of the screen

Blaze 26 I'm working on a website and I'm going to start with a mobile stylesheet first. But the width of the container fluid is not the same as the width of the window. The way I am trying to fix this is: .container-fluid{ width: 105% } The problem n

Bootstrap 3 fluid container with center content

George I'm sure this might be simple, but I haven't figured it out yet. As with non-fluid containers, how do I create a full-screen fluid container and keep the content containing the navigation in the center of the page? I just want the top nav/header backgro