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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
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.
If the stylesheet 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 CSS 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.
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 class="container">
<header>
<nav>
<ul>
<li class="logo"><a href="#"><i class="fa fa-file-code-o" aria-hidden="true"></i>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<button>Login</button>
</header>
<div class="wrapper">
<section class="main">
<h2>Text wrap around the ellipse by using the shape-outside property</h2>
<div class="ellipse"></div>
<p>Starting from the outside and working in, adding display: flex; to the container is the first step in any flexbox layout. The flex-direction is column, so this will position all sections under each other. </p>
<p>One handy thing is how easy it is to align text. In the navigation, with align-items: baseline, all navigation items are aligned to the baseline of the text so they look more uniform. </p>
<p>Podcasting operational change management inside of workflows to establish a framework. Taking seamless key performance indicators offline to maximise the long tail. Keeping your eye on the ball while performing a deep dive on the start-up mentality to derive convergence on cross-platform integration.</p>
<p>Collaboratively administrate empowered markets via plug-and-play networks. Dynamically procrastinate B2C users after installed base benefits. Dramatically visualize customer directed convergence without revolutionary ROI.</p>
<p>Efficiently unleash cross-media information without cross-media value. Quickly maximize timely deliverables for real-time schemas. Dramatically maintain clicks-and-mortar solutions without functional solutions. </p>
</section>
</div>
<footer>
<h3>Shape-outside</h3>
<p>Hope you enjoyed learning about ellipses and how to use shape-outside!</p>
</footer>
</div>
@import url('https://fonts.googleapis.com/css?family=Montserrat:400,500,600,700');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
a {
color: inherit;
text-decoration: none;
}
body {
background-color: #eee;
color: #434344;
font-family: "Montserrat", sans-serif;
font-weight: 400;
}
/* Page Layout */
.container {
max-width: 850px;
margin: 0 auto;
padding: 0 40px;
display: flex;
flex-direction: column;
background-color: #fff;
}
/* Header */
header{
color: #898989;
padding: 20px 0;
margin-bottom: 40px;
text-transform: uppercase;
border-bottom: 2px solid #cccccc;
display: flex;
justify-content: space-between;
}
header nav ul {
display: flex;
align-items: baseline;
list-style-type: none;
}
header nav li {
margin-right: 15px;
}
header button {
border: none;
padding: 8px 25px;
color: #fff;
font-weight: 600;
cursor: pointer;
border-radius: 1.25rem;
background-color: #764ABC;
}
/* Main Section */
.wrapper {
display: flex;
}
.main {
flex: 3;
}
.main h2 {
font-size: 32px;
margin: 1rem 0;
color: #764ABC;
}
.main p {
font-size: 1rem;
margin-bottom: .75rem;
}
.ellipse {
width: 200px;
height: 400px;
background-color: #764ABC;
float: left;
shape-outside: ellipse(100px 200px at 50% 50%) padding-box;
clip-path: ellipse(100px 200px at 50% 50%);
padding-box: 15px;
}
/* Sidebar */
.logo {
font-size: 2rem;
margin-right: 1.5rem;
color: #764ABC;
}
/* Footer */
footer {
color: #898989;
text-align: center;
padding: 20px 0;
margin-top: 60px;
padding: 20px 0;
background-color: #e7e7e7;
}
footer p {
color: #434344;
font-size: 12px;
padding: 10px;
}
@media (max-width: 600px) {
.wrapper {
flex-direction: column;
}
.main {
margin-right: 0;
margin-bottom: 60px;
}
}
Also see: Tab Triggers