Utpal Paul
Utpal Paul

Reputation: 23

How the child div cover the full width of the parent div in Bootstrap without using positioning?

I have a child div within the Bootstrap container div. How can the child div cover the full width of the parent ?

<div class="container">
     <div class="row">
         <div class="col-md-12 parent">
             <div class="Full-Width"></div>
         </div>
     </div>
  </div>

How to make this .Full-Width div width 100% of it's parent div ?

Upvotes: 2

Views: 6155

Answers (4)

Bootstrap 4 you can use w-100 class.

<div class="container">
    <div class="row">
        <div class="col-md-12 parent">
            <div class="w-100"></div>
        </div>
    </div>
</div>

Reference: [https://getbootstrap.com/docs/4.0/utilities/sizing/][1]

Upvotes: 2

evrim oku
evrim oku

Reputation: 229

Bootstrap gives padding for some elements by default. So you have to add custom class to those elements and set padding to 0.

http://jsfiddle.net/732a8rmp/

Upvotes: 2

BCDeWitt
BCDeWitt

Reputation: 4773

CSS

.Full-Width {
    display: block
}

This can also be done using:

.Full-Width {
    width: 100%
}

Upvotes: 0

Adam Buchanan Smith
Adam Buchanan Smith

Reputation: 9439

Umm, you should probably re-word your question because as it sits right now,

this css: .Full-Width{width: 100%;} answers your question.

Upvotes: 1

Related Questions