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>
<textarea id="source">
class: middle
# CSS Grid
---
class: middle
# Topics
#### 1. What Is CSS Grid?
#### 2. The Problem
#### 3. The Solution
#### 4. Release
#### 5. Support
#### 6. Upcoming Improvements
---
class: middle
### What is CSS Grid
---
class: middle
### What is CSS Grid
A modern CSS display mode that allows us to create responsive multi-column layouts.
---
class: middle
### What is CSS Grid
A modern CSS display mode that allows us to create responsive multi-column layouts. And more!
---
class: middle
### Other Uses:
- Centering elements vertically and horizontally
- Overlapping and stacking without absolute positioning
---
class: middle
### What is the problem that CSS Grid solves?
---
class: middle
### What is the problem that CSS Grid solves?
Previous to Grid, responsive grid layouts were created using floats (not designed for layouts) or Flexbox (only allows us to wrap items, does not affect them both horizontally _and_ vertically).
Both approaches take a lot more code to create a repsonsive multicolumn layout, compared to grid.
---
class: middle
### What is the solution?
---
class: middle
### What is the solution?
CSS Grid! It allows you to affect elements in a grid both horizontally and vertically, and includes powerful properties that allow us to write a fraction of the code previously needed to achieve a grid layout. It also includes a gap property to make styling gutters easier.
Another advantage is it separates CSS from HTML, in that we can apply grid to any container and achieve our desired result, rather than having to create specific markup to work with Flexbox or floats.
---
class: middle
### Release
CSS Grid was released in January 2017 on Chrome and Firefox, followed by Safari and Opera a month later. Even IE11 had a primitive version of the spec built in that you could leverage with polyfills!
---
class: middle
### Support
CSS Grid has almost 96% support according to caniuse.com! We should all be using it! Even newer features like "gap", "repeat", and "minmax" have almost 95% support.
---
class: middle
### Upcoming Improvements
Level 2 & 3 of the CSS grid spec will inclide things like masonry layout, subgrid, align/justify tracks and line names.
---
class: middle
### Learning
- [Grid.io By Wes Bos](https://cssgrid.io/)
- [Webpack 5 Basics](https://www.youtube.com/watch?v=X1nxTjVDYdQ)
- [Layout Land with Jen Simmons](https://www.youtube.com/channel/UC7TizprGknbDalbHplROtag)
- [CSS Tricks Complete Guide to Grid](https://css-tricks.com/snippets/css/complete-guide-grid/)
---
class: middle
# Thanks for watching!
</textarea>
<script src="https://remarkjs.com/downloads/remark-latest.min.js">
</script>
<script>
var slideshow = remark.create();
</script>
</body>
@import url('https://fonts.googleapis.com/css?family=Heebo:300,400,500,700|Inconsolata');
/* Global Styles */
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.remark-container {
background-color: #111;
}
.remark-slide-content h1, .remark-slide-content h2 {
font-weight: 500;
}
.remark-slide-content p, .remark-slide-content li, .remark-slide-content td, .remark-slide-content th {
font-size: 24px;
line-height: 1.6;
}
pre, .remark-code, .remark-inline-code {
background-color: #333;
color: #f6f6f6;
font-family: Inconsolata, monospace;
font-size: 16px;
padding: 3px;
}
th {
border-bottom: 1px solid black;
}
td, th {
padding: 8px;
}
img {
display: block;
max-width:100%;
max-height:100%;
width: auto;
height: auto;
}
.center img {
margin-right: auto;
margin-left: auto;
}
.smaller p, .smaller div, .smaller li, .smaller th, .smaller td {
font-size: 18pt;
}
.footnote p {
position: absolute;
bottom: 3em;
font-size: 8pt !important;
}
.remark-slide-number {
background-color: white;
padding: 0 5px;
border-radius: 5px;
font-size: 20px !important;
}
.no-number .remark-slide-number {
display: none;
}
#qrcode {
width: 384px;
height: 384px;
}
/* Title Slide Layout. Use .smokescreen[...] to contain the h1/h2. */
.remark-slide-content.title h1, .remark-slide-content.title h2, .remark-slide-content.title h3 {
color: white;
font-size: 50pt;
margin: 30pt;
font-weight: 300;
}
.remark-slide-content.title h2 {
font-size: 30pt;
}
.remark-slide-content.title h3 {
font-size: 22pt;
}
.smokescreen {
width: 100%;
position: absolute;
left: 0px;
top: 33%;
background-color: rgba(0,0,0,.7);
vertical-align: middle;
text-align: center;
}
/* Columnar Layouts. Two- and three-column layouts use .col classnames and float
* next to each other. The img-right uses .col and .rc (for right-column) and
* they're not equal-width or height. For convenience, two-column layouts also
* allow you to name the right column with .rc classname, so you can switch
* between layouts without changing the markup, just the slide's class.
*/
/* Two-Column Layout */
.two-column .rc, .two-column .col {
width: 48%;
float: left;
margin-right: 1%;
}
.two-column .rc img, .two-column .col img, .three-column .col img, .three-column .rc img {
display: block;
min-width: 100%;
min-height: 100%;
max-width: 100%;
max-height: 100%;
width: auto;
height: auto;
margin: 0;
padding: 0;
}
/* Two-Column Layout, Text Left, Image Right */
.img-right .col {
width: 62.5%;
padding-right: 1em;
}
.img-right .rc {
position: absolute;
top: 0;
left: 62.5%;
width: 37.5%;
height: 100%;
margin: 0;
padding: 0;
}
.img-right .rc p { /* Remove empty line above image wrapped in <p> */
padding: 0;
margin: 0;
}
/* Three-Column Layout */
.three-column .col, .three-column .rc {
width: 32%;
float: left;
}
/* Shrink Images To Fit In A Vertical Space */
.img-450h img {
display: block;
max-height: 450px !important;
width: auto;
margin: 0;
padding: 0;
}
.img-300h img {
display: block;
max-height: 300px !important;
width: auto;
margin: 0;
padding: 0;
}
.center img, .img-center img {
display: block;
margin-left: auto;
margin-right: auto;
}
Also see: Tab Triggers