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 URL's 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 it's URL and the proper URL extention.
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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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 id="grid-wrapper" class="wrapper">
<!-- Top Nav -->
<nav class="top-nav">
<h1><span class="logo-red">FlexGrid.</span>Studio</h1>
<div>
<ul>
<li><a href="#welcome-top">Home</a></li>
<li><a href="#our-designs">Design</a></li>
<li><a href="#about-us">About Me</a></li>
<li><a href="#contact-form">Contact</a></li>
</ul>
<a href="#!" id="burger-menu" onclick="toggleSideMenu()"><i class="fas fa-bars"></i></a>
</div>
</nav>
<!-- Welcome container -->
<section id="welcome-top" class="welcome" onclick="closeSideMenu_ifOpen()">
<h1><span class="logo-red">FlexGrid.</span>Studio</h1>
<h3>Prisons | Fires | Web Design</h3>
<ul>
<li><a href="https://www.facebook.com/iShaymus" target="_blank"><i class="fab fa-facebook" target="_blank"></i></a></li>
<li><a href="http://www.twitter.com/ishaymus" target="_blank"><i class="fab fa-twitter"></i></a></li>
<li><a href="http://www.linkedin.com/in/iShaymus" target="_blank"><i class="fab fa-linkedin" target="_blank"></i></a></li>
<li><a href="http://www.github.com/ishaymus" target="_blank"><i class="fab fa-github"></i></a></li>
</ul>
</section>
<!-- Design Container -->
<section id="our-designs" class="design" onclick="closeSideMenu_ifOpen()">
<h1>Our Designs</h1>
<div>
<article class="design-article">
<img src="https://i.gyazo.com/0fed473e38becb64f1dc2f1c6f79dd0d.jpg" alt="">
<aside>
<h4>Portfolio</h4>
<p>Portfolio Zipline for freeCodeCamp</p>
</aside>
</article>
</div>
</section>
<!-- About Container -->
<section id="about-us" class="about" onclick="closeSideMenu_ifOpen()">
<div class="img-container">
<img id="pic-me" src="https://images.pexels.com/photos/36031/firefighter-fire-portrait-training.jpg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="A photo of me">
</div>
<aside>
<div class="about-text">
<h1>About Us</h1>
<p>I have been a Correctional Officer for 9 years. A volunteer Firefighter for 7 years and a hobby coder for 15 years. I am now learing full stack web development!
</p>
</div>
</aside>
</section>
<!-- Contact Container -->
<section id="contact-form" class="contact" onclick="closeSideMenu_ifOpen()">
<h1>Contact</h1>
<form action="javascript:;" onsubmit="return mockContactSubmit(this);">
<input type="text" name="name" id="contact-name" placeholder="Name" required>
<input type="email" name="email" id="contact-email" placeholder="Email" required>
<textarea name="message" id="contact-message" placeholder="Your Message" required></textarea>
<button type="submit">Submit</button>
</form>
</section>
<footer onclick="closeSideMenu_ifOpen()">
<a href="https://www.facebook.com/iShaymus" target="_blank"><i class="fab fa-facebook" target="_blank"></i></a>
<a href="http://www.twitter.com/ishaymus" target="_blank"><i class="fab fa-twitter"></i></a>
<a href="http://www.linkedin.com/in/iShaymus" target="_blank"><i class="fab fa-linkedin" target="_blank"></i></a>
<a href="http://www.github.com/ishaymus" target="_blank"><i class="fab fa-github"></i></a>
</footer>
<div id="side-menu" class="side-nav">
<!--<a href="#!" class="btn-close" onclick="closeSideMenu()">×</a>-->
<a href="#welcome-top" onclick="closeSideMenu()">Home</a>
<a href="#our-designs" onclick="closeSideMenu()">Design</a>
<a href="#about-us" onclick="closeSideMenu()">About Me</a>
<a href="#contact-form" onclick="closeSideMenu()">Contact</a>
</div>
</div>
html, body {
box-sizing: border-box;
font-family: Arial, Helvetica, sans-serif;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: scroll;
overflow-x: hidden;
}
::-webkit-scrollbar {
width: 0px;
background: transparent;
}
::-webkit-scrollbar-thumb {
background: #FF0000;
}
img {
width: 100%;
}
body {
transition: margin-right 0.5s, margin-left 0.5s;
}
.wrapper {
display: grid;
transition: margin-right 0.5s, margin-left 0.5s;
}
.logo-red {
color: red;
}
/* Top Nav Bar */
.top-nav {
position: fixed;
top: 0;
z-index: 1;
background-color: #090f0f;
width: 100%;
margin: 0;
box-shadow: 0 2px 50px black;
display: grid;
grid-template-columns: auto auto;
color: white;
}
.top-nav h1 {
padding-left: 1rem;
font-size: 1.6rem;
}
.top-nav div {
display: flex;
flex-direction: column;
align-items: flex-end;
justify-content: center;
padding-right: 1rem;
}
.top-nav ul {
list-style: none;
display: none;
}
.top-nav li {
display: inline-block;
padding: 1.2rem 1rem;
}
.top-nav li:hover {
background-color: red;
}
.top-nav a {
text-decoration: none;
color: inherit;
font-size: 2rem;
}
/* Welcome Section */
.welcome {
background-image: url("https://images.pexels.com/photos/953213/pexels-photo-953213.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260");
background-position: bottom;
background-repeat: no-repeat;
background-size: cover;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
}
.welcome img {
grid-area: img;
width: 50%;
}
.welcome h1 {
grid-area: head;
font-size: 6vw;
font: outline;
margin: 0;
padding-bottom: 1.5rem;
border-bottom: 2px white solid;
color: white;
text-shadow: 0 2px 50px black;
}
.welcome h3 {
grid-area: subt;
margin: 0;
padding-top: 1.5rem;
font-size: 4vw;
color: white;
text-shadow: 0 2px 50px black;
}
.welcome ul {
grid-area: social;
margin-top: 10vh;
padding: 0;
justify-content: center;
}
.welcome li {
display: inline;
list-style: none;
font-size: 6vw;
margin: 1rem;
text-shadow: 0 2px 50px black;
}
.welcome a {
text-decoration: none;
color: white;
font-weight: bold;
}
/* Design */
.design {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-image: url("https://images.pexels.com/photos/392018/pexels-photo-392018.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
padding-bottom: 2rem;
}
.design h1 {
color: white;
margin: 0;
padding: 3rem;
font-size: 6vw;
text-shadow: 0 2px 50px black;
}
.design div {
display: grid;
grid-gap: 1rem;
width: 95%;
grid-template-columns: 1fr;
color: white;
}
.design-article {
display: flex;
flex-direction: column;
align-items: center;
padding: 2vw;
border-radius: 0.5rem;
background-color: rgba(0, 0, 0, 0.8);
}
.design-article h4, p {
text-align: center;
margin: 0;
padding: 1rem;
}
.design-article h4 {
font-size: 3vw;
}
.design-article p {
font-size: 2vw;
}
/* About Us */
.about {
display: grid;
background-image: url("https://images.pexels.com/photos/533405/pexels-photo-533405.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260");
background-position: left;
background-repeat: no-repeat;
background-size: cover;
min-height: 100vh;
}
.about div {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 2rem;
}
.about img {
max-width: 80%;
border: 10px white solid;
box-shadow: 2px 2px 50px black;
}
.about aside {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
color: white;
text-align: center;
}
.about-text {
background-color: rgba(0, 0, 0, 0.7);
border-radius: 0.5rem;
margin: 1rem;
padding: 1rem;
}
.about h1 {
font-size: 6vw;
margin: 0;
padding: 0;
}
.about p {
font-size: 2vw
}
/* Contact Form */
.contact {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
background-image: url("https://images.pexels.com/photos/326424/pexels-photo-326424.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
padding: 2vw;
}
.contact h1 {
font-size: 6vw;
color: white;
margin: 0;
padding: 2rem;
text-shadow: 0 2px 50px black;
}
.contact form {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 2rem;
height: 70vh;
width: 90vw;
background-color: yellowgreen;
border-radius: 1rem;
}
.contact input, textarea {
box-sizing: border-box;
width: 100%;
height: 4rem;
font-size: 3vh;
padding: 0.8rem;
border: none;
border-radius: 0.4rem;
margin: 0.6rem 0;
}
.contact input:focus {
border: 2px dodgerblue solid;
}
.contact textarea:focus {
border: 2px dodgerblue solid;
}
#contact-message {
transition: height 0.4s ease-in-out;
resize: none;
font-size: 3vh;
resize: none;
}
#contact-message:focus {
height: 12rem;
}
.contact button {
width: 100%;
height: 4rem;
padding: 0.8rem;
margin: 1rem 0;
border: 4px white solid;
border-radius: 0.4rem;
background-color: dodgerblue;
color: white;
font-size: 200%;
}
.contact button:hover {
background-color: crimson;
}
/* Footer */
footer {
display: flex;
align-items: center;
justify-content: center;
font-size: 3rem;
color: white;
background-color: black;
}
footer a {
margin: 1rem;
text-decoration: none;
color: white;
}
/* Burger menu */
.side-nav {
height: 100%;
width: 0;
position: fixed;
z-index: 2;
right: 0;
background-color:#36454f;
opacity: 1;
overflow-x: hidden;
padding: 60px 0;
transition: width 0.5s;
-webkit-box-shadow: inset 12px 0px 18px 0px rgba(0,0,0,0.75);
-moz-box-shadow: inset 12px 0px 18px 0px rgba(0,0,0,0.75);
box-shadow: inset 12px 0px 18px 0px rgba(0,0,0,0.75);
}
.side-nav a{
padding:10px 10px 10px 30px;
text-decoration:none;
text-align: right;
font-size:5vw;
margin: 0 20px;
color:white;
border-bottom: 2px #ccc solid;
display:block;
transition:0.3s ease-in-out;
}
.side-nav a:hover{
color:#fff;
background-color: red;
border-radius: 0.5rem;
}
.side-nav .btn-close{
position:absolute;
top: 0;
left: 0;
font-size:50px;
font-weight: bold;
border: none;
margin-left:0;
}
@media (min-width:768px) {
/* Design */
.design div {
grid-template-columns: 1fr 1fr;
}
}
@media (min-width:1024px) {
/* Design */
.design div {
grid-template-columns: 1fr 1fr 1fr 1fr;
}
.about {
grid-template-columns: 1fr 1fr;
}
.about div {
justify-content: center;
}
.about aside {
justify-content: center;
}
#burger-menu {
display: none;
}
.top-nav ul {
display: inline;
margin: 0;
padding: 0;
}
.contact form {
width: 50vw;
}
}
/* Provides a message to the user the the contact form does not work as this site has no backend
to sumbit contact information*/
function mockContactSubmit(contactForm){
var sName;
var sEmail;
var sMessage;
sName = contactForm.name.value;
sEmail = contactForm.email.value;
sMessage = contactForm.message.value;
window.alert(`The following information\n\nName: ${sName}\nEmail: ${sEmail}\nMessage: ${sMessage}\n\nWas not sent as this website has no backend and is purely cosmetic.`);
contactForm.reset();
}
/* Code for burger menu to toogle open or close the side menu for mobile devices */
function toggleSideMenu(){
if(document.getElementById("side-menu").style.width == '80vw') {
closeSideMenu();
}
else {
openSideMenu();
}
}
/* Closes the mobile side menu when any area of the body is clicked on
only works if the side menu is already open*/
function closeSideMenu_ifOpen(){
if(document.getElementById("side-menu").style.width == '80vw') {
closeSideMenu();
}
}
/* Opens the side menu from the right and slides the body off screen to
the left. Animate with transitions to the sidebar and body elements */
function openSideMenu(){
document.getElementById("side-menu").style.width = '80vw';
document.body.style.marginRight = '80vw';
document.body.style.marginLeft = '-80vw';
}
/* Closes the open sidebar. Animate with transition to body and sidebar */
function closeSideMenu(){
document.getElementById('side-menu').style.width = '0';
document.body.style.marginRight = '0';
document.body.style.marginLeft = '0';
}
Also see: Tab Triggers