HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div class="container">
<div class="side-nav">
<div class="profile">
<img src="https://placekitten.com/350/350?image=10" alt="">
</div>
<div class="icon-container">
<i class="fa fa-home"></i>
</div>
<div class="icon-container">
<i class="fas fa-calendar"></i>
</div>
<div class="icon-container active">
<i class="fa fa-comment-alt"></i>
</div>
<div class="icon-container">
<i class="fa fa-list"></i>
</div>
<div class="icon-container">
<i class="fa fa-sticky-note"></i>
</div>
</div>
<div class="main-veiw">
<div class="top-nav">
<div class="logo">< CHAT APP /></div>
</div>
<div class="content">
<div class="message-list">
<div class="list-top">
<input type="text">
<button class="search">
<i class="fa fa-search"></i>
</button>
<button class="add">
+
</button>
<button class="close-list">
<i class="fa fa-chevron-left"></i>
</button>
</div>
<div class="list">
<div class="contact unread">
<div class="icon">
<img src="https://placekitten.com/200/200" alt="kitten-image">
</div>
<div class="blurb">
<h2 class="name">
Steve Wiggins
</h2>
</div>
</div>
<div class="contact unread active">
<div class="icon">
<img src="https://placekitten.com/200/200?image=2" alt="kitten-image">
</div>
<div class="blurb">
<h2 class="name">
Invasion Force
</h2>
</div>
</div>
<div class="contact">
<div class="icon">
<img src="https://placekitten.com/550/555" alt="kitten-image">
</div>
<div class="blurb">
<h2 class="name">
John Doe
</h2>
</div>
</div>
<div class="contact">
<div class="icon">
<img src="https://placekitten.com/700/700?image=16" alt="kitten-image">
</div>
<div class="blurb">
<h2 class="name">
Maria Hugges
</h2>
</div>
</div>
<div class="contact">
<div class="icon">
<img src="https://placedog.net/400/400" alt="puppy-image">
</div>
<div class="blurb">
<h2 class="name">
Commander Dave
</h2>
</div>
</div>
</div>
</div>
<div class="chat">
<div class="top">
<div class="open-message">
<i class="fa fa-chevron-left"></i>
</div>
<div class="name" id="open">
Invasion Force
</div>
<div class="button-container">
<button>
<i class="fa fa-phone"></i>
</button>
<button>
<i class="fa fa-camera"></i>
</button>
<button>
<i class="fa fa-folder"></i>
</button>
</div>
</div>
<div class="message-container">
<div class="comment me">
<img src="https://placekitten.com/300/300?image=10" alt="">
<div class="bubble">
<img src="https://dummyimage.com/400x400/ddd/fff" alt="">
</div>
</div>
<div class="comment me">
<img src="https://placekitten.com/300/300?image=10" alt="">
<div class="bubble">
Let me know if this works
</div>
</div>
<div class="comment other">
<img src="https://placekitten.com/700/700?image=16" alt="">
<div class="bubble">
yes this is great
</div>
</div>
<div class="divider"><span>
Feb 8 12:01
</span></div>
<div class="comment other">
<img src="https://placekitten.com/700/700?image=12" alt="">
<div class="bubble">
Did you find a place for monday's metting?
</div>
</div>
<div class="comment me">
<img src="https://placekitten.com/300/300?image=10" alt="">
<div class="bubble">
I found a couple venues. The one on meeting street seems nice.
</div>
</div>
<div class="comment me">
<img src="https://placekitten.com/300/300?image=10" alt="">
<div class="bubble">
can you give me some guidelines to follow as I look for one?
</div>
</div>
<div class="comment other">
<img src="https://placekitten.com/1000/1000?image=12" alt="">
<div class="bubble">
Here's a link to a good one. It should be avalible.
<a href="#">venues.com</a>
</div>
</div>
<div class="divider">
<span>Today 8:58 PM</span>
</div>
<div class="comment me">
<img src="https://placekitten.com/300/300?image=10" alt="">
<div class="bubble">
Are we still holding the metting on monday?
</div>
</div>
<div class="comment other">
<img src="https://placekitten.com/1000/1000?image=12" alt="">
<div class="bubble">
Yeah, can you bring napkins?
</div>
</div>
<div class="comment other">
<img src="https://placekitten.com/700/700?image=16" alt="">
<div class="bubble">
I've got napkins covered 👍
</div>
</div>
<div class="comment me">
<img src="https://placekitten.com/300/300?image=10" alt="">
<div class="bubble">
How do you feel about terraforming?
</div>
</div>
<div class="comment other">
<img src="https://placekitten.com/1000/1000?image=12" alt="">
<div class="bubble">
I feel like thats's a bit off topic.
</div>
</div>
</div>
<div class="input-container">
<button class="attach">
<i class="fa fa-paperclip"></i>
</button>
<div class="textarea-container">
<textarea type="text" placeholder="message"></textarea>
</div>
<button class="send">
<i class="fa fa-paper-plane"></i>
</button>
</div>
</div>
<div class="contact-detail">
<button class="close">
x
</button>
<img src="https://placekitten.com/200/200?image=2" alt="">
<h3>Invasion Force</h3>
<div class="bio">
A bunch of great weirdos
</div>
<ul class="contact-list">
<li>
<img class="contact-img" src="https://placekitten.com/700/700?image=16" alt="">
<span class="name">
Maria Hugges
</span>
</li>
<li>
<img class="contact-img" src="https://placekitten.com/1000/1000?image=12" alt="">
<span class="name">
Lucy Farrel
</span>
</li>
<li>
<img class="contact-img" src="https://placekitten.com/540/540" alt="">
<span class="name">
Your Neighbor
</span>
</li>
<li>
<img class="contact-img" src="https://placedog.net/300/300" alt="">
<span class="name">
Sam Willis
</span>
</li>
</ul>
</div>
</div>
</div>
</div>
@import url("https://fonts.googleapis.com/css2?family=Roboto&display=swap");
:root {
--grey-1: #2a2a2b;
--grey-2: #494848;
--grey-3: #131312;
--grey-4: #333334;
--grey-5: #bbb;
--color-1: #64af50; /*#1F09AC*/
--font-1: "Roboto", sans-serif;
}
body {
margin: 0px;
overflow: hidden;
}
.container {
display: grid;
grid-template-columns: 80px auto;
grid-template-rows: 100vh;
}
/*======= Side Nav ==========*/
.side-nav {
background: var(--grey-3);
color: white;
font-size: 25px;
text-align: center;
height: 100%;
z-index: 2;
}
.side-nav .profile img {
margin-top: 15px;
width: auto;
height: 60px;
filter: grayscale(1);
border-radius: 50%;
}
.icon-container {
line-height: 60px;
height: 60px;
}
.icon-container:hover {
background: var(--grey-2);
}
.icon-container + .active {
border-left: 8px solid var(--color-1);
}
.top-nav {
border-bottom: 1px solid grey;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.top-nav .logo {
text-align: center;
font-size: 150%;
font-weight: bold;
font-family: "Roboto", sans-serif;
color: var(--color-1);
}
.main-veiw {
display: grid;
grid-template-columns: auto;
grid-template-rows: 8vh 92vh;
}
.content {
display: grid;
grid-template-columns: 40% auto;
grid-template-rows: 100%;
}
@media screen and (min-width: 800px) {
.content {
grid-template-columns: 30% auto;
}
}
@media screen and (max-width: 640px) {
.content {
grid-template-columns: auto;
}
}
/*=========Message List======*/
.message-list {
background: var(--grey-2);
height: 100%;
}
@media screen and (max-width: 640px) {
.message-list {
position: absolute;
display: none;
z-index: 1;
}
}
.message-list .list-top {
display: grid;
grid-template-columns: 60% 22% 18%;
padding: 5px;
}
.message-list .list-top .close-list {
display: none;
}
@media screen and (max-width: 640px) {
.message-list .list-top {
grid-template-columns: 60% 20% 10% 10%;
}
.message-list .list-top .close-list {
display: block;
position: absolute;
background: transparent;
border: none;
content: "\2039";
font-size: 20px;
font-family: var(--font-1);
color: white;
top: 15px;
right: 15px;
}
}
.message-list input {
display: inline;
font-size: 20px;
padding: 10px 10px;
border-radius: 30px 0px 0px 30px;
outline: none;
border: none;
background: var(--grey-1);
color: white;
}
.message-list .search {
display: inline;
border: none;
border-radius: 0px 30px 30px 0px;
background: var(--grey-1);
color: white;
outline: none;
}
.message-list .add {
border: none;
background: transparent;
font-size: 30px;
color: white;
outline: none;
}
.message-list .contact {
display: grid;
grid-template-columns: 25% auto;
height: 50px;
padding: 10px;
background: var(--grey-1);
color: white;
font-family: var(--font-1);
position: relative;
}
@media screen and (max-width: 640px) {
.message-list .contact {
display: grid;
grid-template-columns: 60px auto;
}
}
.message-list .active {
background: var(--grey-4);
}
.message-list .unread:before {
content: "";
display: block;
position: absolute;
top: 11px;
left: 11px;
height: 12px;
width: 12px;
border-radius: 50%;
background: var(--color-1);
z-index: 1;
}
.message-list .name {
margin: 5px 10px;
font-size: 16px;
font-weight: 100;
}
.message-list img {
height: 100%;
width: auto;
max-height: 50px;
border-radius: 50%;
filter: grayscale(1);
z-index: 2;
}
/*======== Chat Part ===========*/
.chat {
display: grid;
grid-template-rows: 8vh 72vh 20vh;
overflow: hidden;
height: 100%;
width: 100%;
}
/*========= Top Nav ============*/
.chat .top {
font-family: "Roboto", sans-serif;
width: 100%;
display: flex;
align-items: center;
}
.chat .top .open-message {
padding: 0 10px;
color: var(--grey-3);
display: none;
}
@media screen and (max-width: 640px) {
.chat .top .open-message {
display: block;
}
}
.chat .top .open-message:hover {
color: var(--color-1);
transition: color ease 0.5s;
}
.chat .top .name {
font-size: 20px;
font-weight: 600;
color: grey;
margin-left: 10px;
width: 200px;
cursor: pointer;
}
.chat .top .name:hover {
color: var(--color-1);
transition: color ease 0.5s;
}
.chat .button-container {
text-align: right;
width: 75%;
}
.chat .button-container button {
border: none;
background: white;
font-size: 20px;
color: var(--grey-2);
}
.chat .button-container button:hover {
color: var(--color-1);
transition: color ease 0.5s;
}
/*======== Chat Message Container =====*/
.chat .message-container {
padding: 5px;
overflow-y: scroll;
width: 100%;
height: 96%;
padding-right: 18px;
box-sizing: content-box;
}
.chat .divider {
width: 100%;
height: 30px;
line-height: 30px;
color: var(--grey-5);
font-family: var(--font-1);
text-align: center;
position: relative;
display: inline-block;
}
.chat .divider span {
background: white;
padding: 0px 10px;
}
.chat .divider:before {
content: "";
position: absolute;
left: 0;
top: 14px;
height: 1px;
width: 100%;
background: var(--grey-5);
z-index: -1;
}
.chat .comment {
min-height: 50px;
width: 100%;
float: left;
margin: 5px 0px;
text-align: left;
}
.chat .me {
float: right;
text-align: right;
}
.chat .comment img {
filter: grayscale(1);
height: 50px;
width: auto;
border-radius: 50%;
float: left;
}
.chat .me img {
float: right;
}
.chat .bubble {
display: inline-block;
background: var(--color-1);
padding: 8px 12px;
border-radius: 8px;
color: white;
font-family: var(--font-1);
max-width: 55%;
position: relative;
margin: 0px 15px;
}
.chat .me .bubble {
background: var(--grey-5);
text-align: left;
}
.chat .other .bubble:before {
content: "";
top: 0px;
left: -25px;
position: absolute;
background: transparent;
height: 0px;
width: 0px;
border-left: 15px solid transparent;
border-bottom: 15px solid transparent;
border-right: 20px solid var(--color-1);
}
.chat .me .bubble:after {
content: "";
position: absolute;
top: 0px;
right: -25px;
background: transparent;
height: 0px;
width: 0px;
border-right: 15px solid transparent;
border-bottom: 15px solid transparent;
border-left: 20px solid var(--grey-5);
}
.chat .bubble img {
border-radius: 5px;
height: 200px;
width: auto;
filter: none;
}
.chat .bubble a {
color: white;
}
/*======== Typing part =========*/
.chat .input-container {
display: grid;
grid-template-columns: 8vh auto 8vh;
padding: 10px 6px;
border-top: 1px solid #ccc;
}
.chat .attach {
border: none;
border-radius: 50%;
width: 100%;
height: 8vh;
max-height: 60px;
max-width: 60px;
}
.chat .textarea-container {
width: 100%;
height: 100%;
overflow: hidden;
}
.chat textarea {
border: none;
outline: none;
font-size: 16px;
font-family: "Roboto", sans-serif;
resize: none;
overflow-y: scroll;
width: 100%;
height: 8vh;
padding-right: 18px;
box-sizing: content-box;
margin-left: 10px;
}
.chat .send {
border: none;
background: var(--color-1);
color: white;
font-size: 20px;
height: 8vh;
width: 8vh;
border-radius: 50%;
max-height: 60px;
max-width: 60px;
}
/*======= Contact List =======*/
.contact-detail {
position: absolute;
right: 0;
top: 0;
width: 300px;
height: 100%;
background: #eee;
display: none;
font-family: "Roboto", sans-serif;
padding: 0px 10px;
overflow-y: scroll;
}
.close {
font-size: 20px;
border: none;
background: transparent;
}
.contact-detail img {
width: 70%;
height: auto;
display: block;
margin: 0 auto;
filter: grayscale(0);
border-radius: 50%;
}
.contact-detail h3 {
color: var(--grey-2);
text-align: center;
margin: 8px 0px;
font-size: 22px;
}
.contact-detail .bio {
text-align: center;
}
.contact-detail ul {
margin: 0px;
margin-top: 10px;
padding: 0px;
}
.contact-detail ul li {
list-style: none;
width: 100%;
background: white;
height: 55px;
display: flex;
align-items: center;
padding: 10px 0px;
border-radius: 8px;
margin-bottom: 5px;
}
.contact-detail ul li .contact-img {
border-radius: none;
height: auto;
width: 55px;
margin: 0 10px;
display: inline-block;
filter: grayscale(1);
}
.contact-list ul li .name {
display: inline-block;
}
var element = document.querySelector(".message-container");
element.scrollTop = element.scrollHeight;
let open = document.querySelector("#open");
let close = document.querySelector(".close");
let panel = document.querySelector(".contact-detail");
open.onclick = function () {
gsap.set(panel, {
display: "block",
x: 300
});
gsap.to(panel, 0.5, { x: 0 });
};
close.onclick = function () {
gsap.to(panel, 0.5, { x: 320 });
};
let openList = document.querySelector(".open-message");
let closeList = document.querySelector(".close-list");
let list = document.querySelector(".message-list");
openList.onclick = function () {
gsap.set(list, { display: "block", x: -300 });
gsap.to(list, 0.5, { x: 0});
};
closeList.onclick = function () {
gsap.to(list, 0.5, {x: -400});
gsap.to(list, 0, {display: "none", delay: 1});
}
Also see: Tab Triggers