N
N
Nikidze2020-04-30 17:39:28
css
Nikidze, 2020-04-30 17:39:28

How to overlap one block with another?

There is a structure:

<div>
    <div class="a">Контент</div>
    <div class="b">Блок, который затемняет его</div>
</div>


How can I make the block with class b occupy the entire area of ​​the parent and darken the A block.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Ankhena, 2020-04-30
@Nikidze

Set the big block to position relative.
Set the b block to absolute and set the height and width to 100% or top, right, bottom and left to 0.

Q
Qeuvec, 2020-04-30
@Qeuvec

z-index. This property only works on elements that have their position set to absolute, fixed, or relative. Syntax: z-index: number;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question