L
L
lexxand2020-12-08 18:34:22
HTML
lexxand, 2020-12-08 18:34:22

Is it possible to hide the divs that are generated on the search page?

Comrades, help me solve the problem - there is a directory on CMS Wordpress, it has a directory. A friend asked for help - he needs to display only one catalog search result. That is, the user is looking for something in the catalog, and a page with the code is generated for him

<div class="drts-row drts-gutter-sm">
     <div class="drts-col-12 drts-col-sm-6 drts-col-lg-4 drts-view-entity-container :container(width>320px) :container(width>720px)">
      <div class="drts-col-12 drts-col-sm-6 drts-col-lg-4 drts-view-entity-container :container(width>320px) :container(width>720px)">
       <div class="drts-col-12 drts-col-sm-6 drts-col-lg-4 drts-view-entity-container :container(width>320px) :container(width>720px)">

That is, three more divs are nested in one div, which are the search results.
Is it possible to hide all divs except the first search result via css? Somewhere in the header, write the code ... In the search results, there can be either 1 or 50
<div class="drts-col-12 drts-col-sm-6 drts-col-lg-4 drts-view-entity-container :container(width>320px) :container(width>720px)">

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg, 2020-12-08
@lexxand

Crutch, but if necessary, so

.drts-row .drts-gutter-sm div{
 display:hidden;
}
.drts-row .drts-gutter-sm:first-child{
 display:block;
}

It's better to limit the number of results.)

E
Egor Varenik, 2020-12-09
@egovar

First, I would give this container a custom class, let's call it classname.
.classname > div:not(:first-child) {
display: none;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question