Infants Posted January 30, 2013 Report Share Posted January 30, 2013 Labdien. Ir koda gabaliņš: <div> <h5>CAT 1</h5> <ul> <li>sub1</li> <li>sub2</li> <li>sub3</li> <li>sub4</li> </ul> <h5>CAT 2</h5> <ul> <li>sub5</li> <li class="active">sub6</li> <li>sub7</li> <li>sub8</li> </ul> </div> Nevaru atrast, kā 'pa skaisto' css'ā atrast to <h5>, kuram blakus (pēc kura) ir <ul><li class="active"> P.s. Ar jquery parent('ul').prev('h5') strādā smuki, bet vai tas ir iespējams ar css? Quote Link to comment Share on other sites More sharing options...
daGrevis Posted January 30, 2013 Report Share Posted January 30, 2013 Ja nekļūdos, ar CSS nevarēsi iet kokā uz augšu. Tāpēc nevarēsi izdarīt šādi: `.active [parent ul]`. Quote Link to comment Share on other sites More sharing options...
marrtins Posted January 30, 2013 Report Share Posted January 30, 2013 (edited) Varbūt kaut kādos hipsterjaunākajā css var (bet varbūt arī nevar). Nāksies vien taisīt parent child child child. Uzliec tam main divam kādu klasi/id un tad div.klase ul li.active { border: 1px solid red; } Edited January 30, 2013 by marrtins Quote Link to comment Share on other sites More sharing options...
werd Posted January 31, 2013 Report Share Posted January 31, 2013 Varbūt kaut kādos hipsterjaunākajā css var (bet varbūt arī nevar). Nāksies vien taisīt parent child child child. Uzliec tam main divam kādu klasi/id un tad div.klase ul li.active { border: 1px solid red; } Kā diez šis atradīs "h5", kas nav "ul" child elements? Quote Link to comment Share on other sites More sharing options...
marrtins Posted January 31, 2013 Report Share Posted January 31, 2013 Piemet klasi active. Pārpratu uzdevumu, tas mans selektors nepareizs. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.