<header class="header-class">
<a href="#default" class="logo">BLACKOUT STUDIO</a>
<div class="header-right">
<a class="active" href="#home">Home</a>
<a href="#contact">Contact</a>
<a href="#about">About</a>
</div>
</header>
<main>
<div class="container">
<div class="cont-window">
<div class="conv-wrapper">
<div id="conv-cont">
<div class="chat-info">
<div class="chat-pic">
<img alt="img_profile" src="https://img.icons8.com/plasticine/100/000000/person-male.png" />
</div>
<div class="chat-name">
Aswin Tommy
</div>
</div>
<div class="conv conv-left">
<div class="conv-bubble">
<div class="msg-info">
<div class="msg-info-name">
Aswin
</div>
<div class="msg-info-time">
20:11
</div>
</div>
<div class="msg-text">
Courier New is the most widely used monospace serif font.
New is also the standard font for movie screenplays.
</div>
</div>
</div>
</div>
<div id="msg-box-cont">
<div class="msg-btn-cont">
<form class="chat-form">
<input type="text" class="chat-input" placeholder="Enter your message...">
<button type="submit"><img alt="icon_send" src="https://img.icons8.com/ios/50/000000/send-letter--v1.png" /></button>
</form>
</div>
</div>
</div>
</div>
<div class="cont-ls-cont">
<div class="cont-list">
<div class="chat-cont-img">
<img alt="img_profile" src="https://img.icons8.com/plasticine/100/000000/person-male.png" />
</div>
<div class="chat-cont-img">
<img alt="img_profile" src="https://img.icons8.com/plasticine/100/000000/person-male.png" />
</div>
<div class="chat-cont-img">
<img alt="img_profile" src="https://img.icons8.com/plasticine/100/000000/person-male.png" />
</div>
<div class="chat-cont-img">
<img alt="img_profile" src="https://img.icons8.com/plasticine/100/000000/person-male.png" />
</div>
<div class="chat-cont-img">
<img alt="img_profile" src="https://img.icons8.com/plasticine/100/000000/person-male.png" />
</div>
<div class="chat-cont-img">
<img alt="img_profile" src="https://img.icons8.com/plasticine/100/000000/person-male.png" />
</div>
<div class="chat-cont-img">
<img alt="img_profile" src="https://img.icons8.com/plasticine/100/000000/person-male.png" />
</div>
</div>
</div>
</div>
</main>
<!-- Footer -->
<footer class="footer-class">
<p>
<p> <tt> © COPYRIGHT BLACKOUT 2020 | ALL RIGHT RESERVED </tt> </p>
</p>
</footer>
<script type="text/javascript" src="main.js"></script>
html,
body {
background-color: white;
margin: 0;
padding: 0%;
height: 100%;
align-items: center;
}
li {
display: inline;
text-decoration: none;
color: aliceblue;
}
/* Scroll Bar */
::-webkit-scrollbar {
width: 5px;
}
::-webkit-scrollbar-track {
box-shadow: inset 0 0 2px grey;
border-radius: 3px;
}
::-webkit-scrollbar-thumb {
background: dimgray;
border-radius: 1px;
}
/* Header */
.header-class {
overflow: hidden;
background-color: #080000;
padding: 20px 10px;
}
.header-class a {
float: left;
color: #fffbf0;
text-align: center;
padding: 12px;
text-decoration: none;
font-size: 18px;
line-height: 25px;
border-radius: 1px;
}
.header-class a.logo {
font-size: 25px;
font-weight: bold;
}
.header-class a:hover {
background-color: #282828;
color: #fffbf0;
}
.header-class a.active {
background-color: #480000;
color: white;
}
.header-right {
float: right;
}
/*when the screen is 500px wide or less, stack the links on top of each other */
@media screen and (max-width: 450px) {
.header-class a {
float: none;
display: block;
text-align: left;
padding: 10px;
font-size: 14px;
line-height: 15px;
}
.header-class a.logo {
font-size: 20px;
}
.header-right {
float: none;
}
::-webkit-scrollbar {
width: 3px;
}
}
/*chat window*/
.container {
margin: auto;
position: fixed;
width: 65%;
height: 64%;
transform: translateY(1%);
-ms-transform: translateY(1%);
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.cont-window {
height: 100%;
width: 86%;
float: left;
position: relative;
border: 2px solid black;
background: white;
box-shadow: 0 15px 15px -5px rgba(0, 0, 0, 0.2);
}
.cont-ls-cont {
float: right;
border: 2px solid black;
background: white;
width: 11%;
height: 100%;
box-shadow: 0 15px 15px -5px rgba(0, 0, 0, 0.2);
overflow-y: scroll;
overflow-x: hidden;
}
input[type="text"],
select,
textarea {
width: 60%;
padding: 12px;
border: 1px solid black;
border-radius: 4px;
box-sizing: border-box;
resize: vertical;
}
.conv-wrapper {
display: flex;
flex-flow: column wrap;
justify-content: space-between;
width: 100%;
margin-top: 0px;
overflow: hidden;
height: 100%;
}
#conv-cont {
flex: 1;
overflow-y: scroll;
width: 100%;
}
.chat-info {
height: auto;
width: fit-content;
display: flex;
margin-bottom: 7px;
margin-top: 5px;
background-color: #071b2f;
border-radius: 50px;
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}
.chat-pic {
width: 50px;
height: 50px;
align-items: center;
transform: translateY(-0px);
background: rgb(255, 255, 255);
background-repeat: no-repeat;
background-position: center;
background-size: cover;
border-radius: 50%;
order: 2;
border: 5px solid #071b2f;
margin-left: 5px;
}
.chat-pic img {
width: 100%;
height: auto;
}
.chat-name {
display: inline-block;
vertical-align: top;
color: #fffbf0;
background-color: #071b2f;
height: 90%;
padding: 10px;
width: 150px;
font-family: "Nunito";
}
.conv {
display: flex;
align-items: flex-end;
}
.conv-right {
flex-direction: row-reverse;
}
.conv-right .conv-bubble {
max-width: 70%;
padding: 12px;
right: 0;
margin-right: 7px;
margin-bottom: 2px;
padding-bottom: 2px;
border-radius: 15px;
color: lightgrey;
background-color: #071b2f;
border-top-right-radius: 0;
}
.conv-left .conv-bubble {
margin-bottom: 2px;
max-width: 70%;
padding: 12px;
border-radius: 15px;
margin-left: 7px;
background-color: lightgray;
border-top-left-radius: 0;
}
.msg-info {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
.msg-info-name {
font-weight: bold;
margin-right: 10%;
font-size: medium;
font-family: "Nunito";
}
.msg-info-time {
font-size: small;
}
.msg-text {
margin: 0;
margin-bottom: 3px;
font-family: "Fuzzy Bubbles";
font-size: 16px;
}
#msg-box-cont {
position: relative;
width: 100%;
bottom: 0;
padding: 0;
margin-top: 5px;
background-color: #200000;
border: 1px solid black;
}
.msg-btn-cont {
padding: 3px;
position: relative;
background-color: black;
}
.msg-btn-cont input {
width: 100%;
height: 100%;
box-sizing: border-box;
border: 2px;
border-radius: 18px;
}
.msg-btn-cont button {
position: absolute;
top: 0;
right: 0;
bottom: 0;
margin: 4px;
border-radius: 25px;
padding: 0;
border: 0;
overflow: hidden;
}
.msg-btn-cont img {
width: 100%;
height: 100%;
object-fit: cover;
}
.cont-list {
height: auto;
width: 100%;
}
.chat-cont-img {
border-bottom: 0.5px solid grey;
width: 100%;
height: 100px;
padding: 3px;
padding-top: 5px;
}
.cont-list img {
border-bottom: 0.5px solid grey;
display: block;
width: auto;
height: 90px;
border-radius: 50%;
margin-left: auto;
margin-right: auto;
}
.cont-list :hover {
background-color: lightgrey;
}
@media screen and (max-width: 450px) {
.cont-window {
height: 50%;
width: 94%;
transform: translateY(16%);
-ms-transform: translateY(16%);
}
.conv-wrapper {
height: 86%;
}
.conv-bubble {
max-width: 60%;
}
.msg-text {
font-size: small;
}
.msg-info {
margin-bottom: 3px;
}
.msg-info-name {
font-size: small;
}
.msg-info-time {
font-size: x-small;
}
.conv-right .conv-bubble {
margin-right: 3px;
}
.conv-left .conv-bubble {
margin-right: 3px;
}
.chat-name {
width: 110px;
font-size: small;
}
}
/* Footer*/
.footer-class {
color: aliceblue;
position: absolute;
bottom: 0;
width: 100%;
height: 15%;
background-color: #080000;
text-align: center;
}
.footer-class p {
font-size: 18px;
}
@media screen and (max-width: 450px) {
.footer-class p {
font-size: 12px;
}
}
const chatCont = document.querySelector("#conv-cont");
const chatForm = document.querySelector(".chat-form");
const chatInput = document.querySelector(".chat-input");
chatForm.addEventListener("submit", (event) => {
event.preventDefault();
const msgText = chatInput.value;
if (!msgText) return;
appendMessage(msgText);
chatInput.value = "";
});
function appendMessage(text) {
const msgHTML = `
<div class="conv conv-right">
<div class="conv-bubble">
<div class="msg-info">
<div class="msg-info-name">
John
</div>
<div class="msg-info-time">
20:11
</div>
</div>
<div class="msg-text">
${text}
</div>
</div>
</div>
`;
chatCont.insertAdjacentHTML("beforeend", msgHTML);
chatCont.scrollTop += 100;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.