I set the position:fixed parameter to li so that when scrolling, they "go" to the block in which they are located, but as a result, when applying position:fixed , all li are mixed in a heap so that only one last button is visible:

 ul { padding-top: 11px; } .spisok { height: 100px; width: 238px; background-color: #7B2019; /*margin-top: -73%;*/ /*border*/ border-bottom: 0px solid #000; border-left: 0px solid #000; border-right: 15px solid #000; /*border ends*/ } .spisok li { width: 195px; height: 45px; display: block; margin-right: 10px; margin-left: 13.2px; position: fixed; background-image: url(../img/span_menu.png); color: rgba(222, 222, 222 .1); background-size: cover; -webkit-transition: All 0.3s ease-in-out; -moz-transition: All 0.3s ease-in-out; -o-transition: All 0.3s ease-in-out; -ms-transition: All 0.3s ease-in-out; transition: All 0.3s ease-in-out; } .spisok li a { width: 100%; height: 100%; text-decoration: none; font-family: CyrillicOldBold, sans-serif; letter-spacing: 0.5px; color: white; text-decoration: none; font-size: 16px; font-weight: normal; position: relative; display: list-item; text-align: -webkit-match-parent; text-align: center; padding-left: 9px; } .spisok ul>li:hover { background-image: url(../img/span_menu_hover.png); background-repeat: no-repeat; background-size: cover; -webkit-transition: All 0.3s ease-in-out; -moz-transition: All 0.3s ease-in-out; -o-transition: All 0.3s ease-in-out; -ms-transition: All 0.3s ease-in-out; transition: All 0.3s ease-in-out; } .spisok ul li>a:hover { text-shadow: gold 0 0 40px; /* Свечение голубого цвета */ color: white; } .spisok ul li ap { padding-top: 14px; margin-top: 5px; } .text-div { width: 158px; height: 30px; text-align: center; margin-left: -9px; } .letter-spacing { letter-spacing: 1px; } 
 <div class="spisok"> <ul> <li> <a class="text-div" id="oblacheniya" href="http:///test.ru/left_menu/oblacheniya.php"> <p><span class="letter-spacing">Облачения</span></p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/podrizniki.php"> <p><span class="letter-spacing">Подризники</span></p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/stihari.php"> <p><span class="letter-spacing">Стихари</span></p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/ryasi.php"> <p><span class="letter-spacing, ryasi">Рясы</span></p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/podryasniki.php"> <p><span class="letter-spacing">Подрясники</span></p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/golovniye_ubori.php"> <p><span class="letter-spacing">Головные уборы</span></p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/for_monahov.php"> <p><span class="letter-spacing">Для монахов</span></p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/kresh_nabory.php"> <p>Крещальные наборы</p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/vench_nabory.php"> <p>Венчальные наборы</p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/obl_for_hrama.php"> <p>Облачения для храма</p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/vishitiye_kresty.php"> <p><span class="letter-spacing">Вышитые кресты</span></p> </a> </li> <li id="ugol"> <a class="text-div" href="http:///test.ru/left_menu/ugol.php"> <p><span class="letter-spacing">Кадильный уголь</span></p> </a> </li> </ul> </div> 

  • There is not a single li - vp_arth
  • Where is your li in html? Show html code - artem55555p
  • Sorry, I forgot that he connects via php, now I'll fill in the main post - Quick Brown Fox
  • Done, the code is filled) - Quick Brown Fox
  • one
    0) Make a minimally reproducible example. Resetting styles and a five-page sheet will discourage any desire to penetrate and help. 1) Remove the pieces of PHP and clog them with plugs if needed. 2) Paste in one snippet, it makes no sense to divide into two. - user207618

2 answers 2

Approximately so? I think the colors will change

 ul { padding-top: 11px; } .spisok { height: 300px; /*width: 21.1%;*/ position:fixed; overflow-y:scroll; background-color: #7B2019; /*margin-top: -73%;*/ /*border*/ border-bottom: 0px solid #000; border-left: 0px solid #000; border-right: 15px solid #000; /*border ends*/ } .spisok::-webkit-scrollbar-button { background-image:url(''); background-repeat:no-repeat; width:6px; height:0px } .spisok::-webkit-scrollbar-track { background-color:#32312e; box-shadow:0px 0px 3px #000 inset; } .spisok::-webkit-scrollbar-thumb { -webkit-border-radius: 5px; border-radius: 5px; background-color:#ffcb17; box-shadow:0px 1px 1px #fff inset; background-image:url('https://yraaa.ru/_pu/24/59610063.png'); background-position:center; background-repeat:no-repeat; } .spisok::-webkit-resizer{ background-image:url(''); background-repeat:no-repeat; width:7px; height:0px } .spisok::-webkit-scrollbar{ width: 11px; } .spisok li { width: 195px; height: 45px; display: block; margin-right: 10px; margin-left: 13.2px; background-image: url(../img/span_menu.png); color: rgba(222, 222, 222 .1); background-size: cover; -webkit-transition: All 0.3s ease-in-out; -moz-transition: All 0.3s ease-in-out; -o-transition: All 0.3s ease-in-out; -ms-transition: All 0.3s ease-in-out; transition: All 0.3s ease-in-out; } .spisok li a { width: 100%; height: 100%; text-decoration: none; font-family: CyrillicOldBold, sans-serif; letter-spacing: 0.5px; color: white; text-decoration: none; font-size: 16px; font-weight: normal; position: relative; display: list-item; text-align: -webkit-match-parent; text-align: center; padding-left: 9px; } .spisok ul>li:hover { background-image: url(../img/span_menu_hover.png); background-repeat: no-repeat; background-size: cover; -webkit-transition: All 0.3s ease-in-out; -moz-transition: All 0.3s ease-in-out; -o-transition: All 0.3s ease-in-out; -ms-transition: All 0.3s ease-in-out; transition: All 0.3s ease-in-out; } .spisok ul li>a:hover { text-shadow: gold 0 0 40px; /* Свечение голубого цвета */ color: white; } .spisok ul li ap { padding-top: 14px; margin-top: 5px; } .text-div { width: 158px; height: 30px; text-align: center; margin-left: -9px; } .letter-spacing { letter-spacing: 1px; } 
 <div class="spisok"> <ul> <li> <a class="text-div" id="oblacheniya" href="http:///test.ru/left_menu/oblacheniya.php"> <p><span class="letter-spacing">Облачения</span></p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/podrizniki.php"> <p><span class="letter-spacing">Подризники</span></p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/stihari.php"> <p><span class="letter-spacing">Стихари</span></p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/ryasi.php"> <p><span class="letter-spacing, ryasi">Рясы</span></p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/podryasniki.php"> <p><span class="letter-spacing">Подрясники</span></p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/golovniye_ubori.php"> <p><span class="letter-spacing">Головные уборы</span></p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/for_monahov.php"> <p><span class="letter-spacing">Для монахов</span></p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/kresh_nabory.php"> <p>Крещальные наборы</p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/vench_nabory.php"> <p>Венчальные наборы</p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/obl_for_hrama.php"> <p>Облачения для храма</p> </a> </li> <li> <a class="text-div" href="http:///test.ru/left_menu/vishitiye_kresty.php"> <p><span class="letter-spacing">Вышитые кресты</span></p> </a> </li> <li id="ugol"> <a class="text-div" href="http:///test.ru/left_menu/ugol.php"> <p><span class="letter-spacing">Кадильный уголь</span></p> </a> </li> </ul> </div> 

  • As I understand it, @Quick Brown Fox should not be spisok fixed, namely li - artem55555p
  • then just pick from .spisok position: fixed; - klifort
  • @klifort for some reason, when you copy your settings to page styles, the menu disappears altogether from the screen - Quick Brown Fox
  • height: 300px; width: 246px; position: relative; overflow-y: scroll; top: -100%; background-color: # 7B2019; border-bottom: 0px solid # 000; border-left: 0px solid # 000; border-right: 15px solid # 000; - klifort
  • heights give a fixed - 300px, 500px. Because at 100% you will not have a scroll and the menu block will be the entire height of the style list, just add 'overflow-y: scroll;' and adjust width as you add scroll - klifort

If I understand you correctly, then you need to do the spisok fixed class, not li, now li is fixed:

 ul { padding-top: 11px; } .spisok { overflow:auto; position: fixed; height: 400px; width: 238px; background-color: #7B2019; /*margin-top: -73%;*/ /*border*/ border-bottom: 0px solid #000; border-left: 0px solid #000; border-right: 15px solid #000; /*border ends*/ } .spisok li { width: 195px; height: 45px; display: block; margin-right: 10px; margin-left: 13.2px; background-image: url(../img/span_menu.png); color: rgba(222, 222, 222 .1); background-size: cover; -webkit-transition: All 0.3s ease-in-out; -moz-transition: All 0.3s ease-in-out; -o-transition: All 0.3s ease-in-out; -ms-transition: All 0.3s ease-in-out; transition: All 0.3s ease-in-out; } .spisok li a { width: 100%; height: 100%; text-decoration: none; font-family: CyrillicOldBold, sans-serif; letter-spacing: 0.5px; color: white; text-decoration: none; font-size: 16px; font-weight: normal; position: relative; display: list-item; text-align: -webkit-match-parent; text-align: center; padding-left: 9px; } .spisok ul>li:hover { background-image: url(../img/span_menu_hover.png); background-repeat: no-repeat; background-size: cover; -webkit-transition: All 0.3s ease-in-out; -moz-transition: All 0.3s ease-in-out; -o-transition: All 0.3s ease-in-out; -ms-transition: All 0.3s ease-in-out; transition: All 0.3s ease-in-out; } .spisok ul li>a:hover { text-shadow: gold 0 0 40px; /* Свечение голубого цвета */ color: white; } .spisok ul li ap { padding-top: 14px; margin-top: 5px; } .text-div { width: 158px; height: 30px; text-align: center; margin-left: -9px; } .letter-spacing { letter-spacing: 1px; } 
 <div class="spisok"> <ul> <li><a class="text-div" id="oblacheniya" href="http:///test.ru/left_menu/oblacheniya.php"> <p><span class="letter-spacing">Облачения</span></p></a></li> <li><a class="text-div" href="http:///test.ru/left_menu/podrizniki.php"><p><span class="letter-spacing">Подризники</span></p></a></li> <li><a class="text-div" href="http:///test.ru/left_menu/stihari.php"><p><span class="letter-spacing">Стихари</span></p></a></li> <li><a class="text-div" href="http:///test.ru/left_menu/ryasi.php"><p><span class="letter-spacing, ryasi">Рясы</span></p></a></li> <li><a class="text-div" href="http:///test.ru/left_menu/podryasniki.php"><p><span class="letter-spacing">Подрясники</span></p></a></li> <li><a class="text-div" href="http:///test.ru/left_menu/golovniye_ubori.php"><p><span class="letter-spacing">Головные уборы</span></p></a></li> <li><a class="text-div" href="http:///test.ru/left_menu/for_monahov.php"><p><span class="letter-spacing">Для монахов</span></p></a></li> <li><a class="text-div" href="http:///test.ru/left_menu/kresh_nabory.php"><p>Крещальные наборы</p></a></li> <li><a class="text-div" href="http:///test.ru/left_menu/vench_nabory.php"><p>Венчальные наборы</p></a></li> <li><a class="text-div"href="http:///test.ru/left_menu/obl_for_hrama.php"><p>Облачения для храма</p></a></li> <li><a class="text-div" href="http:///test.ru/left_menu/vishitiye_kresty.php"><p><span class="letter-spacing">Вышитые кресты</span></p></a></li> <li id="ugol"><a class="text-div" href="http:///test.ru/left_menu/ugol.php"><p><span class="letter-spacing">Кадильный уголь</span></p></a></li> </ul> </div> 

  • Comments are not intended for extended discussion; conversation moved to chat . - Qwertiy