L
L
lolo_to2021-04-02 20:00:50
css
lolo_to, 2021-04-02 20:00:50

Is it possible to apply display: flex properties to grandchildren instead of children?

Is it possible to apply styles from display: flex not to children, but to grandchildren, as in the example:

<style>
    .block_flex {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .block_flex .item {
        align-self: center;
    }
</style>

<div class="block_flex">
    <a>
        <span class="item">Пункт</span>
    </a>
    <a>
        <span class="item">Пункт</span>
    </a>
    <a>
        <span class="item">Пункт</span>
    </a>
</div>

those. styles from .block_flex applied not to <a> but to <span>?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xdevelx, 2021-04-02
@lolo_to

If for children - links to apply display: contents, then it will be possible.
https://css-live.ru/articles/display-contents-prac...

L
lolo_to, 2021-04-02
@lolo_to

Unfortunately, styles are applied only to child elements, so as far as I know, this is not possible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question