Непонятные изменения в размере блока списка

у меня проблема с размером блока списка, сам код не мой, при наведение на блок списка он сильно изменяется. Вот код HTML

    <body>

    <div>

        <nav class="dws-menu">
            <input type="checkbox" name="toggle" id="menu" class="toggleMenu">
            <label for="menu" class="toggleMenu"><i class="fa fa-bars"></i>Меню</label>
            <ul>
              <li><a href="#"><i class="fa fa-home"></i>Главная</a></li>
              <li><a href="#"><i class="fa fa-home"></i>Фильмы</a></li>
              <li><a href="#"><i class="fa fa-home"></i>Музыка</a></li>
              <li><a href="#"><i class="fa fa-home"></i>Книги</a></li>
              <li><a href="#"><i class="fa fa-home"></i>Аудиокниги</a></li>
            </ul>
        
        </nav>
        <button class="sign_up">Вход</button>
        <button class="button_bar"><i class="fa-solid fa-magnifying-glass i"></i></button>
    </div>

        <div class="content">
            <h1>sdfgnhgfdsfghg</h1>
        </div>
    {% block content %}
    {% endblock %}
    </div>

</body>

css у меня 3 файла css:

*{
margin: 0;
padding: 0;
box-sizing: border-box;
}

.i{
font-size: 50px;
}

.sign_up{
    background-color: #E3C65F;
    height: 45px;
    width: 75px;
    border-radius: 10px;
    position: absolute;
    right: 80px;
}

.button_bar{
    background-image: none; 
    background: transparent;
    background-color: rgba(255, 255, 0, 0);
    color: #E3C65F;
    width: 50px;
    height: 45px;
    border: none;
}

дальше:

*{
margin: 0;
padding: 0;
box-sizing: border-box;
}

header{
    /*margin-top: 200px;*/
    font-family: Cuprum, Arial, Helvetica, sans-serif;
}
.dws-menu ul,
.dws-menu ol{
    list-style: none;
}
.dws-menu > ul{
    display: flex;
    justify-content: center;
}
.dws-menu > ul li{
    position: relative;
    border-right: 1px solid #c7c8ca;
}
.dws-menu > ul li:first-child{
    border-left: 1px solid #b2b3b5;
}
.dws-menu > ul li:last-child{
    border-right: 1px solid #babbbd;
}
.dws-menu > ul li > a i.fa{
    position: absolute;
    top: 15px;
    left: 12px;
    font-size: 18px;
}
.dws-menu > ul li a{
    display: block;
    background: rgb(201,201,201); /* Old browsers */
    background: -moz-linear-gradient(top,  rgba(201,201,201,1) 0%, #E3C65F 2%, #c0a850 98%, 
    rgba(117,117,119,1) 100%); /* FF3.6-15 */
    background: -webkit-linear-gradient(top,  rgba(201,201,201,1) 0%,#E3C65F 2%,#c0a850 98%,rgba(117,117,119,1) 100%); /* Chrome10-25,Safari5.1-6 */
    background: linear-gradient(to bottom,  rgba(201,201,201,1) 0%,#E3C65F 2%,#c0a850 98%,rgba(117,117,119,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#c9c9c9', endColorstr='#757577',GradientType=0 ); /* IE6-9 */

    padding: 15px 30px 15px 40px;
    font-size: 14px;
    color: #454547;
    text-decoration: none;
    text-transform:uppercase;
    transition: all 0.3s ease;
}
.dws-menu li a:hover{
    background: rgb(224,225,229); /* Old browsers */
    background: -moz-linear-gradient(top,  rgba(224,225,229,1) 0%, #E3C65F 2%, #c0a850 98%, rgba(224,225,229,1) 100%); /* FF3.6-15 */
    background: -webkit-linear-gradient(top,  rgba(224,225,229,1) 0%,#E3C65F 2%,#c0a850 98%,rgba(224,225,229,1) 100%); /* Chrome10-25,Safari5.1-6 */
    background: linear-gradient(to bottom,  rgba(224,225,229,1) 0%,#E3C65F 2%,#c0a850 98%,rgba(224,225,229,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e0e1e5', endColorstr='#e0e1e5',GradientType=0 ); /* IE6-9 */

    color: #ffffff;
    box-shadow: 1px 5px 10px -5px black;
    transition: all 0.3s ease;
    width: 50px;
}

.dws-menu li ul{
    position: absolute;
    min-width: 150px;
    display: none;
}
.dws-menu li > ul li{
    border: 1px solid #c7c8ca;
}
.dws-menu li > ul li a{
    padding: 10px;
    text-transform: none;
    background: #e4e4e5;
}
.dws-menu li > ul li ul{
    position: absolute;
    right: -150px;
    top: 0;
}
.dws-menu li:hover > ul{
    display: block;
}

.dws-menu [type="checkbox"],
.dws-menu label.toggleSubmenu{
    display: none;
}
.dws-menu label.toggleMenu{

     background: rgb(201,201,201); /* Old browsers */
    background: -moz-linear-gradient(top,  rgba(201,201,201,1) 0%, #E3C65F 2%, #c0a850 98%, rgba(117,117,119,1) 100%); /* FF3.6-15 */
    background: -webkit-linear-gradient(top,  rgba(201,201,201,1) 0%,#E3C65F 2%,#c0a850 98%,rgba(117,117,119,1) 100%); /* Chrome10-25,Safari5.1-6 */
    background: linear-gradient(to bottom,  rgba(201,201,201,1) 0%,#E3C65F 2%,#c0a850 98%,rgba(117,117,119,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
     filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#c9c9c9', endColorstr='#757577',GradientType=0 ); /* IE6-9 */

    display: none;
    padding: 15px 40px;
    text-transform: uppercase;
    font-size: 14px;
    cursor: pointer;
    position: relative;
    width: 110px;
}

.dws-menu label.toggleMenu .fa{
    position: absolute;
    top: 15px;
    left: 12px;
    font-size: 18px;
}
@media all and (max-width: 800px){
.dws-menu{
    overflow: hidden;
}
.dws-menu ul{
    display: block;
    max-height: 0;
    transition: max-height 0.3s;
    width: 150px;
}
.dws-menu li>ul li ul{
    position: absolute;
    right: auto;
    top: auto;
}
.dws-menu label.toggleMenu{
    display: block;
}
input.toggleMenu:checked + label.toggleMenu{
    background: #000;
    color: #fff;
}
input.toggleMenu:checked ~ ul,
input.toggleSubmenu:checked ~ ul{
    display: block;
    position: relative;
    max-height: 5000px;
    transition: max-height 2s ease-in;
}
.dws-menu label.toggleSubmenu{
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    display: block;
}
input.toggleSubmenu:checked ~ a{
    background: #454547;
    color: #fff;
}
.dws-menu label.toggleSubmenu .fa:before{
    content: "\f0d7";
    color: #454547;
}

}

и последний

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body{
    background-color: #4A5DA9;
}

.navbar{
    background-color: #18296E;
    position: -webkit-sticky;
    position: sticky;
    padding-left: 1%;
    padding-right: 1%;
    height: 45;
    top: 0;
}

.content{
    background-color: #5A497F;
    overflow: auto;
    height: 1000px;
    width: 84%;
    text-align: center;
    margin: auto auto;
}

Если у кого будет такая проблема, то попробуйте изменить:

display: block;

на

display: inline-table;

в элементах списка.

Вернуться на верх