I have a scrolling sidebar menu. So when I select a menu item it should appear at the top position of the sidebar. There is no problem setting up the active menu. I got it. But I can't set the top position of the sidebar. Please do not recommend jQuery. Instead I was advised to use plain JavaScript Here is some code reference
.sidebar{ height:100px overflow-y:scroll; } .sidebar ul li{ padding:30px; }
<!-- CSS --> <!-- html --> <div class="sidebar"> <ul> <li>item1</li> <li>item2</li> <li>item3</li> <li>item4</li> <li>item5</li> <li>item7</li> <li>item8</li> <li>item9</li>........ <li>item100</li> </ul> </div>
Pure CSS solution using
:target
pseudo-class,flexbox
layout, andorder
properties.