M
M
MuTaToRage2015-10-17 21:32:15
css
MuTaToRage, 2015-10-17 21:32:15

How to select the previous selector?

I'm making a tree-like collapsible structure.
There is such html

<div class="tree-line">
  <div class="imgtree last"></div>
  <div class="name">cardiovascular agents</div>
  <div class="children">
    <div class="tree-line">
      <div class="imgtree parent none"></div>
      <div class="imgtree last"></div>
      <div class="name">Calcium channel blocking agents</div>
    </div>
  </div>
</div>

You can somehow set the style for name if it is followed by children,
I know this code
.tree-line .name + .children
{
    color:blue;
    cursor:pointer;
}

will set the color for children standing after name
but it could be somehow
.tree-line .name 
{
    color:blue;
    cursor:pointer;
} + .children

Ps The children element only exists if there are child elements.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question