M
M
madcore2015-08-05 09:08:55
css
madcore, 2015-08-05 09:08:55

Image size for adjacent block?

8577e7eaac7041a88e743646deba3dcc.png
What rules to write in CSS for the left block, while filling the right block with text, the picture would be adjusted to it (to the full height)
(PS. There is a picture as a background)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
VA_ic2b, 2015-08-05
@VA_ic2b

Set the parent element containing the text block and the "picture" block to display: table-row. Child blocks - property display: table-cell.
When doing this, do not forget to specify the width of the child blocks (in the amount of 100% of the parent).
And now background-size: cover

K
kn1ght_t, 2015-08-05
@kn1ght_t

background-size: cover;

L
Lumore, 2015-08-05
@Lumore

Give the block with the image the height of the parent and everything will be fine. The code will be something like this:

<div class="row">
<div class="col-xs-6 image">image</div>
<div class="col-xs-6 content">content</div>
</div>

.image {
height: inherit;
background: url('url');
background-size: cover;
}
.content {
...
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question