<h2>Weekly Coding Challenge #8 <br /> Chat Interface</h2>
<div class="chat-container">
<ul class="chat">
<li class="message left">
<img class="logo" src="https://randomuser.me/api/portraits/women/17.jpg" alt="">
<p>I'm hungry!</p>
</li>
<li class="message right">
<img class="logo" src="https://randomuser.me/api/portraits/men/67.jpg" alt="">
<p>Hi hungry, nice to meet you. I'm Dad.</p>
</li>
<li class="message left">
<img class="logo" src="https://randomuser.me/api/portraits/women/17.jpg" alt="">
<p>DAD! I'm serious!</p>
</li>
<li class="message right">
<img class="logo" src="https://randomuser.me/api/portraits/men/67.jpg" alt="">
<p>I thought your name was hungry...?</p>
</li>
<li class="message left">
<img class="logo" src="https://randomuser.me/api/portraits/women/17.jpg" alt="">
<p>ARE YOU KIDDING ME?</p>
</li>
<li class="message right">
<img class="logo" src="https://randomuser.me/api/portraits/men/67.jpg" alt="">
<p>No, I'm Dad...</p>
</li>
</ul>
<input type="text" class="text_input" placeholder="Message..."/>
</div>
<footer>
<p>
Created with <i class="fa fa-heart"></i> by
<a target="_blank" href="https://florin-pop.com">Florin Pop</a>
- Read how I created this and how you can join the challenge
<a target="_blank" href="https://www.florin-pop.com/blog/2019/04/chat-interface/">here</a>
</p>
</footer>
@import url('https://fonts.googleapis.com/css?family=Lato');
* {
box-sizing: border-box;
}
body {
background: url('https://cdn.pixabay.com/photo/2018/01/14/23/12/nature-3082832_1280.jpg');
background-size: cover;
background-position: center center;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
min-height: 100vh;
font-family: 'Lato', sans-serif;
margin: 0 0 50px;
}
h2 {
text-shadow: 1px 1px 2px rgba(0,0,0,1);
color: #fff;
letter-spacing: 1px;
text-transform: uppercase;
text-align: center;
}
.chat-container {
background-color: rgba(0, 0, 0, 0.4);
border-radius: 25px;
box-shadow: 0px 0px 10px 5px rgba(0,0,0,0.7);
overflow: hidden;
padding: 15px;
position: relative;
width: 320px;
max-width: 100%;
}
.chat {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
list-style-type: none;
padding: 0;
margin: 0;
}
.message {
background-color: rgba(255, 255, 255, 0.9);
border-radius: 50px;
box-shadow: 0px 15px 5px 0px rgba(0,0,0,0.5);
position: relative;
margin-bottom: 30px;
}
.message.left {
padding: 15px 20px 15px 70px;
}
.message.right {
align-self: flex-end;
padding: 15px 70px 15px 20px;
}
.logo {
border-radius: 50%;
box-shadow: 0px 10px 10px 0px rgba(0,0,0,0.7);
object-fit: cover;
position: absolute;
left: 10px;
top: -10px;
width: 50px;
height: 50px;
}
.message.right .logo {
left: auto;
right: 10px;
}
.message p {
margin: 0;
}
.text_input {
font-size: 16px;
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 10px 15px;
width: 100%;
}
footer {
background-color: #222;
color: #fff;
font-size: 14px;
bottom: 0;
position: fixed;
left: 0;
right: 0;
text-align: center;
z-index: 999;
}
footer p {
margin: 10px 0;
}
footer i {
color: red;
}
footer a {
color: #3c97bf;
text-decoration: none;
}
This Pen doesn't use any external JavaScript resources.