html, body { margin: 0; padding: 0; height: 100%; /* Установите высоту в 100%, чтобы…
- User
html, body { margin: 0; padding: 0; height: 100%; /* Установите высоту в 100%, чтобы взять полную высоту экрана / width: 100%; / Установите высоту в 100%, чтобы взять полную высоту экрана / overflow: hidden; / Отключить прокрутку на body, и если у вас есть прокрутка только вертикально, это также можно поменять на авто. */ }
.container { max-width: 100%; margin: 0 auto; height: 100vh; display: flex; flex-direction: column; overflow: hidden; /* Отключить прокрутку для контейнера */ }
.tab-container { display: flex; justify-content: center; background-color: #f8f8f8; border-bottom: 1px solid #e0e0e0; padding: 5px; }
.logo { display: flex; align-items: center; }
.logo img { height: 30px; }
.message-area { flex: 1; padding: 10px; overflow-y: auto; background-color: white; border-top: 1px solid #e0e0e0; border-bottom: 1px solid #e0e0e0; width: 100%; }
.messages { display: flex; flex-direction: column; }
.message { padding: 10px; margin: 5px; border-radius: 8px; max-width: 60%; /* Limit width of message / word-wrap: break-word; / Allow text to wrap */ }
.sent { align-self: flex-end; background-color: #007aff; color: white; }
.received { align-self: flex-start; background-color: #e5e5ea; color: black; }
.bot-response { align-self: flex-start; background-color: #d4edda; /* Light green */ color: black; }
.file-list { display: flex; /* Display files in a row / padding: 10px; background-color: #f8f8f8; border-top: 1px solid #e0e0e0; flex-wrap: wrap; / Allow files to wrap */ }
.file-item { display: flex; justify-content: space-between; align-items: center; margin-right: 10px; /* Spacing between file items */ }
.remove-file { cursor: pointer; color: red; margin-left: 5px; }
.input-area { display: flex; padding: 10px; background-color: white; border-top: 1px solid #e0e0e0; }
#uploadButton { background-color: white; color: black; border: 1px solid #e0e0e0; border-radius: 8px; padding: 10px; margin-right: 5px; cursor: pointer; }
#uploadButton.active { background-color: #d4edda; /* Light green */ }
input[type="text"] { flex: 1; padding: 10px; border: 1px solid #e0e0e0; border-radius: 8px; }
button { background-color: #007aff; color: white; border: none; border-radius: 8px; padding: 10px 15px; margin-left: 5px; cursor: pointer; }
button:disabled { background-color: #ccc; /* Grey when disabled */ }
button:disabled:hover { cursor: not-allowed; /* Not allowed when disabled */ }
.dot-animation { font-weight: bold; }
почему зеленые сообщения с отступом от края, а синие без
- Assistant
Ваша проблема с отступами сообщений в чат-приложении связана с различиями между классами
.sent,.receivedи.bot-response.Классы сообщений:
-
.sent: представляет отправленные сообщения и выравнивается с использованием свойстваalign-self: flex-end;, что означает, что оно будет выровнено к правому краю контейнера, и, поскольку не указаны дополнительные отступы (margin), будет немного прижат к краю.
-