A
A
Aleksandr Zhuravlev2015-10-02 01:35:30
css
Aleksandr Zhuravlev, 2015-10-02 01:35:30

How can I set the height of the parent div to the child div?

How can I make divs with class services-box-bg take the height of the parent container? Why doesn't height: 100%; work?
HTML code:

<div class="row services-box">

    <div class="col-md-4">
        <div class="services-box-bg">
            <p>Текст</p>
        </div>
    </div>

    <div class="col-md-4">
        <div class="services-box-bg">
            <p>Текст</p>
        </div>
    </div>

    <div class="col-md-4">
        <div class="services-box-bg">
            <p>Текст</p>
        </div>
    </div>

</div>

css code:
.services-box{
    padding-top: 10px;
    padding-bottom: 15px;
    margin-top: 5px;
    margin-bottom: 5px;
}
.services-box p{
    text-align: center;
    margin-top: 10px;
}
.services-box-bg{
    background-color: #b4b4b4;
    margin: 10px;
    padding: 20px;
    height: 100%;
}

Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Shamanov, 2015-10-02
@SilenceOfWinter

for example, you can use display: table / table-cell

R
Rithmsamba, 2015-10-02
@Rithmsamba

The parent for services-box-bg is col-md-4

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question