@Httdientee

Сдвиг блока div?

Здравствуйте, я делаю макет чата, мне нужно чтобы при новом сообщении все остальные лезли вверх, сейчас при добавлении сообщения они смещают input ввода вниз, нужно чтобы input оставался на своем месте

HTML:
spoiler
<div class="container-chat-and-input-chat">
        <div class="container-chat">
            <div class="block-chat">
                <div class="this-block-name">
                    <img src="flags/ru.png" alt="">
                    <div class="block-name">test</div>
                    <p>sfdfsdfsdsfdfsdsfdsfdsfdfsdsfd</p>
                </div>
            </div>
            <div class="block-chat">
                <div class="this-block-name">
                    <img src="flags/ua.png" alt="">
                    <div class="block-name">httdiente</div>
                    <p>sfdfsdfsdsfdfsdsfdsfdsfdfsdsfd</p>
                </div>
            </div>   
        </div>
        <div class="container-input-chat">
            <div class="channel"><p>Общий чат</p></div>
            <input type="text" placeholder="Введите сообщение...">
        </div>
    </div>



CSS
spoiler
* {
    margin: 0;
    padding: 0;
}
body {
    background: chocolate;
}
.container-chat {
    display: flex;
    flex-direction: column;
}
.container-chat .block-name {
    color: white;
    margin-left: 20px;
    position: relative;
    top: -16.1px;
    font-size: 15px;
    margin-right: 5px;
    font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.container-chat .this-block-name {
    width: fit-content;
    height: 15px;
    background: rgba(0, 0, 0, 0.50);
    margin-bottom: 2px;
    position: relative;
}
.container-chat img {
    display: block;
    margin-left: 1px;
    padding-top: 2px;
}
.container-chat p {
    color: white;
    font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13.5px;
    position: absolute;
    top: -10%;
    left: 107%;
}
.container-chat .block-chat {
    position: relative;
}
.container-input-chat {
    width: 250px;
    height: 20px;
    background: rgba(0, 0, 0, 0.50);
    position: relative;
}
.container-input-chat input {
    border: none;
    overflow: unset;
    outline: none;
    background: unset;
    color: white;
    font-size: 13.5px;
    font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: absolute;
    top: 0%;
    left: 32%;
}
.container-input-chat input::placeholder {
    color: rgb(167, 164, 164);
    font-weight: 100;
}
.container-input-chat .channel {
    left: 0;
    height: 20px;
    width: 75px;
    background: black;
}
.container-input-chat .channel p {
    color: white;
    font-size: 10.5px;
    text-transform: uppercase;
    font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding-top: 2px;
    padding-left: 5.5px;
}
.container-chat-and-input-chat {
    position: absolute;
    top: 60%;
    left: 1%;
}
  • Вопрос задан
  • 77 просмотров
Решения вопроса 1
@Httdientee Автор вопроса
https://jsfiddle.net/u4mh5dja/

Вот так мне надо было
(Для тех кто будет тестить)
- T открыть чат
- Enter отправить сообщение
- ESC закрыть чат
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
@igumenov

.container-chat {
    display: flex;
    flex-direction: column;
    
   
    max-height: 90px;
    overflow-y: auto;
    overflow-x: hidden;
    
    
}
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы