G
G
gazes122022-02-11 20:53:22
css
gazes12, 2022-02-11 20:53:22

How can I access the first class through a second class that is lower than the first?

.popup_text{
          display: flex;
          flex-direction: column;
          .select{
            z-index: 10;
            cursor: pointer;
            margin-top: 30px;
            .select_body{
              max-width: 400px;
              .select_title{
                border: 1px solid #C6CCD5;
                color: #85898C;
                padding: 10px;
                border-radius: 5px;
                display: flex;
                align-items: center;
                justify-content: space-between;

                i{
                  color: #C6CCD5;
                }

                &.active + .select_content{
                  .item{
                    opacity: 1;
                    visibility: visible;
                  }
                }

                &.active{
                  border-bottom: 1px dashed #C6CCD5;
                }

                &.active{
                  .popup_text{
                    border: 2px solid red;
                  }
                }

              }
              .select_content{
                .item{

                  opacity: 0;
                  visibility: hidden;

                  padding-left: 20px;
                  padding-top: 10px;

                  transition: all 0.5s;

                  background: white;

                  margin-left: 10px;
                  margin-top: 10px;
                  .item_title{
                    display: flex;

                    p{
                      margin-left: 7px;
                      color: #8D99AB;
                      font-size: 17px;
                    }
                  }

                  .item_content{
                    .item{
                      display: flex;
                      margin-top: 15px;

                      p{
                        margin-left: 7px;
                      }
                    }
                  }
                }
              }


I want via .select_title with class active to access .popup_text class which is above .select_title, how can i do that?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Michael, 2022-02-11
@Akela_wolf

gazes12 , if I'm not confusing anything, in CSS you can't set rules for the selector depending on the state of the child elements. It looks like you want something like the :has pseudo -class , but it's not yet supported by browsers.

A
Alexander Vasiliev, 2022-02-11
@amvasiljev

if all this is beyond css, use js/query

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question