U
U
uRoot2018-06-30 18:32:37
css
uRoot, 2018-06-30 18:32:37

How to make after and before responsive?

Hello. There is such a design:

spoiler
5b37a13e4b3b4840998781.png

I made the arrows and the triangle using after and before pseudo-elements, and the blocks themselves - flexbox. And it turns out that the blocks are adaptive, and my pseudo-elements, when the blocks are compressed, leave the boundaries of the parent block. How to make them responsive so that they also shrink with the blocks?
CSS pseudo-element construction:
.news-block:after {
    content: '+';
    font-size: 35px;
    color: #fff;
    position: absolute;
    margin-top: -435px;
    margin-left: 260px;
}

.news-block:before {
    content: ''; 
    position: absolute;
    border: 50px solid transparent; 
    border-top: 50px solid #373737; 
    border-right: 50px solid #373737;
    margin-left: 200px;
    opacity: 0.8;
}

.news-block:hover:before {
    content: ''; 
    position: absolute;
    border: 50px solid transparent; 
    border-top: 50px solid #f26c4f; 
    border-right: 50px solid #f26c4f;
    margin-left: 200px;
    opacity: 0.8;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
A person from Kazakhstan, 2018-06-30
@LenovoId

why margin-left ? absolutely arrange and everything will be in the herringbone: right: 0; etc

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question