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.
<body>
<main>
<section id="photos-ctr">
<img src="https://www.instagram.com/static/images/homepage/home-phones.png/43cc71bb1b43.png" alt="Two smart phones, one black, one white, the white one overlapping the other; both phone screen display example images from the website.">
<div id="phone-display">
<img id="image-1" src="https://www.instagram.com/static/images/homepage/screenshot1.jpg/d6bf0c928b5a.jpg" alt="A woman standing in front of many tall cacti.">
<img id="image-2" src="https://www.instagram.com/static/images/homepage/screenshot2.jpg/6f03eb85463c.jpg" alt="A potted orange Desert Cabbage against a blue wall.">
<img id="image-3" src="https://www.instagram.com/static/images/homepage/screenshot3.jpg/f0c687aa6ec2.jpg" alt="Text conversation contianing images of cats and cat puns.">
<img id="image-4" src="https://www.instagram.com/static/images/homepage/screenshot4.jpg/842fe5699220.jpg" alt="Top view of a green Tree Aeonium plant.">
<img id="image-5" src="https://www.instagram.com/static/images/homepage/screenshot5.jpg/0a2d3016f375.jpg" alt="Instagram profile display for Jane Appleseed.">
</div>
</section>
<section id="details-ctr">
<div id="login-ctr">
<div id="logo">
<img src="https://pbs.twimg.com/media/E_mOsqtXoAQLmN0?format=png&name=240x240" alt="Instragram logo; the text reads 'Instagram', written in the platform's iconic cursive font.">
</div>
<div id="login">
<form id="login-form" action="#">
<div class="form-group">
<input
id="username"
class="form-input"
name="username"
pattern=".{1,}"
placeholder="Phone number, username, or email"
title="Must be a valid phone number, username, or email."
onkeyup="stateHandle()"
required
type="text">
<label class="floating-label" for="username">Phone number, username, or email</label>
</div>
<div class="form-group">
<input
id="password"
class="form-input"
pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}"
placeholder="Password"
title="Must contain at least one number, one uppercase and lowercase letter, and at least 8 or more characters."
oninput="stateHandle()"
required
type="password">
<label class="floating-label" for="password">Password</label>
<button id="show-btn"
onclick="showPassword()"
type="button">Show</button>
<button id="hide-btn"
onclick="showPassword()"
type="button">Hide</button>
</div>
<input
formaction="#"
href="#"
id="login-btn"
name="submit"
type="submit"
value="Log In">
</form>
</div>
<div id="alt-options">
<div id="or-separator">
<div></div>
<p>Or</p>
<div></div>
</div>
<div id="fb-login">
<a href="#"><img src="https://pbs.twimg.com/media/E_mOlZ9XMAIU4bI?format=webp&name=tiny">
<h5>Log in with Facebook</h5></a>
</div>
<div id="pw-forgot">
<p><a href="#">Forgot password?</a></p>
</div>
</div>
</div>
<div id="sign-up-ctr">
<p>Don't have an account? <span><a href="#">Sign Up</a></span></p>
</div>
<div id="get-app-ctr">
<p>Get the app.</p>
<div>
<a href="https://apps.apple.com/app/instagram/id389801252?vt=lo" target="_blank"><img src="https://www.instagram.com/static/images/appstore-install-badges/badge_ios_english-en.png/180ae7a0bcf7.png" alt="Download on the App Store"></a>
<a href="https://play.google.com/store/apps/details?id=com.instagram.android&referrer=utm_source%3Dinstagramweb&utm_campaign=loginPage&ig_mid=4179E4D0-FB3D-4ABE-B9F3-4495B781021B&utm_content=lo&utm_medium=badge" target="_blank"><img src="https://www.instagram.com/static/images/appstore-install-badges/badge_android_english-en.png/e9cd846dc748.png" alt="Get it on Google Play"></a>
</div>
</div>
</section>
</main>
<footer>
<div id="footer-ctr">
<div>
<a href="#">Meta</a>
<a href="#">About</a>
<a href="#">Blog</a>
<a href="#">Jobs</a>
<a href="#">Help</a>
<a href="#">API</a>
<a href="#">Privacy</a>
<a href="#">Terms</a>
<a href="#">Top Accounts</a>
<a href="#">Hashtags</a>
<a href="#">Locations</a>
<a href="#">Instagram Lite</a>
</div>
<div>
<a href="#">Beauty</a>
<a href="#">Dance</a>
<a href="#">Fitness</a>
<a href="#">Foot & Drink</a>
<a href="#">Home & Garden</a>
<a href="#">Music</a>
<a href="#">Visual Arts</a>
</div>
<div>
<select>
<option value="en">English</option>
<option value="en">English</option>
</select>
<p id="select-replace">English</p>
<div id="select-carrot-wrap">
<span>
<svg id="select-carrot" role="img" viewBox="0 0 24 24" height="12" width="12">
<path d="M21 17.502a.997.997 0 01-.707-.293L12 8.913l-8.293 8.296a1 1 0 11-1.414-1.414l9-9.004a1.03 1.03 0 011.414 0l9 9.004A1 1 0 0121 17.502z"></path>
</svg>
</span>
</div>
<p id="meta-gram">© 2021 Instagram from Meta</p>
</div>
</div>
</footer>
<script type="text/javascript" src="ig-clone-java.js"></script>
</body>
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
text-decoration: none;
}
:root {
--fb-blue: rgb(56, 81, 133);
--ig-blue: rgba(0, 140, 255, .9);
--ig-grey-light: rgb(220, 220, 220);
--ig-grey-medium: rgb(138, 138, 138);
--ig-grey-dark: rgb(117, 117, 117);
}
/* ---------- HTML, BODY ELEMENTS ---------- */
html, body {
height: 100vh;
width: 100%;
}
body {
background-color: #FAFAFA;
display: flex;
flex-direction: column;
min-width: 320px;
font-family: 'Segoe UI','Roboto',Helvetica, Arial, sans-serif;
overflow-y: scroll;
}
main {
align-items: center;
display: flex;
justify-content: center;
width: 100%;
height: 100%;
min-height: 630px;
margin-top: .5em;
position: relative;
}
section {
height: 610px;
margin-top: 3.3em;
width: 350px;
}
footer {
color:var(--ig-grey-medium);
display: flex;
flex-direction: column;
font-size: .75em;
margin: 0 auto;
padding: 1.8em 0;
width: 100%;
}
input[type=password]::-ms-reveal
{
display: none;
}
a, a::before, a::after {
color: inherit;
}
a:active {
opacity: .6;
}
#photos-ctr {
display: none;
}
/* ---------- LOGIN CONTAINER DECLERATIONS ---------- */
#login-ctr,
#sign-up-ctr,
#get-app-ctr {
align-items: center;
background-color: white;
border: 1px solid var(--ig-grey-light);
display: flex;
flex-direction: column;
height: 62.25%;
justify-content: center;
margin-bottom: .65em;
}
#login-ctr > div {
display: flex;
flex-direction: column;
height: 30%;
margin: 0 auto;
width: 80%;
}
#login-ctr #logo {
align-items: center;
display: flex;
justify-content: center;
margin: .15em auto .42em;
}
#login-ctr #alt-options,
#login-ctr #login {
height: 35%;
}
#login-ctr #alt-options {
align-items: center;
}
/* --- LOGIN FORM DECLERATIONS --- */
#login .form-group {
position: relative;
transition: all .3s;
}
.form-group .floating-label {
color: var(--ig-grey-medium);
display: block;
font-size: .78em;
position: absolute;
transform: translate(.78em, -2.65em);
transform-origin: 0 0;
transition: all .1s;
z-index: 1;
}
.form-group button {
background-color: transparent;
border: none;
cursor: pointer;
font-family: inherit;
font-weight: 600;
right: 0;
top: 0;
transform: translate(-.75em, .75em);
position: absolute;
visibility: hidden;
}
.form-group button:active {
opacity: .6;
}
input:not(:placeholder-shown) ~ #show-btn {
visibility: visible;
}
input:not(:placeholder-shown) + .floating-label {
transform: translate(.75em, -3.15em) scale(.8);
}
#username:not(:placeholder-shown) {
padding-bottom: .3em;
padding-top: 1.3em;
}
#password:not(:placeholder-shown) {
padding-bottom: .35em;
padding-top: 1.25em;
padding-right: 4.19em;
}
.floating-label {
cursor: text;
}
#login form {
display: flex;
flex-direction: column;
}
#login input {
background-color: #FAFAFA;
border: 1px solid var(--ig-grey-light);
border-radius: .2em;
display: block;
font-family: inherit;
font-size: .78em;
margin-bottom: .5em;
padding: .8em .7em;
width: 100%;
}
input[type="text"]#username:focus,
input[type="password"]#password:focus {
border: 1px solid rgba(138, 138, 138, .7);
outline: none;
}
#login input::placeholder {
font-family: inherit;
color: transparent;
}
#login input[value="Log In"] {
color: white;
background-color: var(--ig-blue);
border: 1px solid currentColor;
border-bottom: 2px solid currentColor;
border-radius: .4em;
font-size: .875em;
font-weight: 500;
margin: .5em 0 .2em;
padding: .36em .7em .42em;
}
#login input[value="Log In"]:hover {
cursor: pointer;
}
#login input[value="Log In"]:disabled {
cursor: inherit;
opacity: .35;
}
#login input[value="Log In"]:enabled {
opacity: 1;
}
#login input[value="Log In"]:active {
opacity: .6;
}
/* --- LOGIN ALT-OPTIONS DECLERATIONS --- */
#or-separator {
align-items: center;
display: flex;
justify-content: center;
margin: .75em 0;
width: 100%;
}
#or-separator div {
background-color: var(--ig-grey-light);
height: 1px;
width: 50%;
}
#or-separator p {
color: var(--ig-grey-medium);
font-size: 12.5px;
font-weight: 500;
padding: 0 1.4em;
text-transform: uppercase;
transform: translateY(5%);
}
#fb-login {
align-items: center;
display: flex;
font-weight: bolder;
padding: .85em;
}
#fb-login img {
display: inline-block;
height: 1em;
transform: translateY(.2em);
width: 1em;
}
#fb-login h5 {
color: var(--fb-blue);
display: inline-block;
font-size: 14px;
font-weight: 600;
margin: .05em 0 .2em;
padding-left: .3em;
}
#pw-forgot {
font-size: .75em;
color: rgb(16, 42, 97);
padding-top: .25em;
transform: translateY(-.1em);
}
/* ---------- SIGN-UP CONTAINER DECLERATIONS ---------- */
#sign-up-ctr {
height: 10.25%;
padding: 1.9em 0;
}
#sign-up-ctr p {
font-size: .875em;
}
#sign-up-ctr span {
color: var(--ig-blue);
font-weight: 500;
}
/* ---------- GET APP CONTAINER DECLERATIONS ---------- */
#get-app-ctr {
background-color: transparent;
border: none;
height: 21.35%;
justify-content: flex-start;
margin-top: .65em;
}
#get-app-ctr p {
font-size: .9em;
padding: .55em 0 .25em;
}
#get-app-ctr > div {
display: flex;
}
#get-app-ctr a {
margin: 1em .25em .5em;
}
#get-app-ctr div img {
height: 2.5em;
}
/* ---------- FOOTER DECLERATIONS ---------- */
#footer-ctr {
position: relative;
padding: 0 2em;
}
#footer-ctr div {
text-align: center;
}
#footer-ctr > div:last-child {
align-items: center;
display: flex;
justify-content: center;
padding: .85em 0 2.9em;
}
#footer-ctr div p {
white-space: nowrap;
}
#footer-ctr div > * {
display: inline-block;
padding: .215em .53em;
}
#footer-ctr select {
background-color: transparent;
border: none;
color:var(--ig-grey-medium);
cursor: pointer;
font: inherit;
font-size: inherit;
opacity: 0;
padding-right: 0;
padding-left: 0;
transform: translateX(6%);
z-index: 10;
}
#select-carrot-wrap span {
position: absolute;
display: inline-block;
transform: rotate(180deg) translateX(95%) translateY(50%);
}
#select-carrot {
color: var(--ig-grey-medium);
fill: var(--ig-grey-medium);
}
#select-replace {
position: absolute;
transform: translateX(-186%);
}
#meta-gram {
transform: translateX(-1%);
}
/* ---------- MEDIA QUERIES ---------- */
@media only screen and (max-width: 450px) {
body {
overflow-x: hidden;
min-width: 0;
}
main {
min-height: 582px;
}
section {
margin-top: 0;
}
#details-ctr {
display: flex;
flex-direction: column;
justify-content: space-between;
height: 100%;
position: absolute;
top: 0;
}
#login-ctr,
#sign-up-ctr,
#get-app-ctr {
background-color: transparent;
border: none;
height: auto;
}
#login-ctr #logo {
margin: 1.1em 0 1.8em;
}
#login-ctr #alt-options {
transform: translateY(.8em);
}
#alt-options #fb-login {
transform: translateY(.1em)
}
#sign-up-ctr {
transform: translateY(.7em);
}
#get-app-ctr {
transform: translateY(-1.3em);
}
}
@media only screen and (min-width: 876px) {
#photos-ctr {
display: block;
position: relative;
}
#photos-ctr img {
height: 618px;
transform: translate( -19.2%, -5.3%);
width: 454px;
}
#photos-ctr div > img {
border: .15em solid rgb(51, 51, 51);
border-bottom: .25em solid rgb(51, 51, 51);
border-left: .22em solid rgb(51, 51, 51);
border-radius: .2em;
height: 27.1em;
left: 6.75em;
position: absolute;
top: 5.4em;
width: 15.3em;
}
@keyframes z-index-shift {
0% {
opacity: 1;
z-index: 5;
}
20% {
opacity: 1;
z-index: 6;
}
27% {
opacity: 0;
z-index: 6;
}
40% {
opacity: 0;
z-indez: 6;
}
60% {
opacity: 0;
z-indez: inherit
}
100% {
opacity: inherit;
z-index: inherit;
}
}
#image-1 {
animation: z-index-shift 25s 0s infinite;
z-index: 4;
}
#image-2 {
animation: z-index-shift 25s 5s infinite;
z-index: 3;
}
#image-3 {
animation: z-index-shift 25s 10s infinite;
z-index: 2;
}
#image-4 {
animation: z-index-shift 25s 15s infinite;
z-index: 1;
}
#image-5 {
animation: z-index-shift 25s 20s infinite;
z-index: 0;
}
}
// GLOBAL VARIABLE DECLERATIONS
let username = document.querySelector("#username");
let password = document.querySelector("#password")
let loginButton = document.querySelector("#login-btn");
let showButton = document.querySelector("#show-btn");
let hideButton = document.querySelector("#hide-btn");
// LOGIN BUTTON ENABLE + DISABLE FUNCTION
loginButton.disabled = true;
username.addEventListener("change", stateHandle);
password.addEventListener("change", stateHandle);
function stateHandle() {
if (username.value.length > 0 && password.value.length > 4 ) {
loginButton.disabled = false;
} else {
loginButton.disabled = true;
}
}
function stateHandleUp() {
if (password.value.length > 5 ) {
loginButton.dsabled = false;
} else {
loginButton.disabled = true;
}
}
// PASSWORD SHOW/HIDE BUTTON SWTICH
function showPassword() {
if (password.type === "password") {
password.type = "text";
showButton.style.display = "none";
hideButton.style.visibility = "visible";
} else {
password.type = "password";
hideButton.style.visibility = "hidden";
showButton.style.display = "inline-block";
}
}
hideButton.style.visibility = "hidden";
Also see: Tab Triggers