Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

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.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <h1>Grid layouts</h1>
<p>Grid layouts aren't limited to living inside of a <strong><code>&lt;DIV&gt;</code></strong>.  We can put them inside lists, too:  Unordered lists <strong><code>&lt;ul&gt;</code></strong> and and ordered lists <strong><code>&lt;ol&gt;</code></strong> are both good candidates for this approach.  Let's take a look at how this works...   
<h2>Plain <strong><code>&lt;ul&gt;</code></strong></h2>
<p>Every letter below is just another <strong><code>&lt;li&gt;</code></strong>:</p>
<code><pre>
&lt;ul&gt;
	&lt;li&gt; A. &lt;/li&gt;
	&lt;li&gt; B. &lt;/li&gt;
	&lt;li&gt; C. &lt;/li&gt;
&lt;/ul&gt;</pre></code>
<ul>
	<li>A.</li>
	<li>B.</li>
	<li>C.</li>
	<li>D.</li>
	<li>E.</li>
	<li>F.</li>
	<li>G.</li>
	<li>H.</li>
	<li>I.</li>
</ul>
<h2>Gridded <strong><code>&lt;ul&gt;</code></strong></h2>
<p>In this example, I've added a class, "gridContainer", to the unordered-list selector, so that the HTML looks like this:</p>
<pre><code> &lt;ul class="gridContainer"&gt; </code></pre>
<p>And in the .CSS, I've added the following:</p>
<pre><code> .gridContainer{
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	grid-gap:10px;
	background-color:gainsboro;
	list-style: none;
}</code></pre>
<p>That last line of the class is a property that keeps an outline from using bullet-points.  Very handy.</p>
<ul class="gridContainer">
	<li>A.</li>
	<li>B.</li>
	<li>C.</li>
	<li>D.</li>
	<li>E.</li>
	<li>F.</li>
	<li>G.</li>
	<li>H.</li>
	<li>I.</li>
	<li>J.</li>
	<li>K.</li>
	<li>L.</li>
	<li>M.</li>
	<li>N.</li>
	<li>O.</li>	
</ul>
<br />
<p>Manipulating the grid from here is easy.  You'll likely want to edit the <strong><code>.gridContainer</code></strong> class I created in the .CSS.  </p>
<p>Start by changing it from a 3-column grid to a 2-column grid.</p>
<p>Then change it from a grid with 2 columns of uniform width to a grid with 4 columns, all of different widths.  Try mixing up your units of measure:  px, em, %, vw.</p>
            
          
!
            
              

ul {
}

li {
	background-color: white;
	padding:5px;
}

.gridContainer {
	border:2px solid black;
	padding:5px;

	list-style: none;
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	grid-gap:10px;
	background-color:gainsboro;
}


/* Styling stuff that isn't
directly related to my explanations, above. */

body {
	background: #f6f3ea;
	/*
	vh is a unit of measure that means
	"viewport height."  Think of it as meaning
	n% of the height of your browser's height.
	
	vw is similar:  "viewport width."  It
	translates to roughly n% of your
	browser's window's width. */

   margin:2vh 20vw; */
	
	/* ^ ^ ^ So the line above means:
	set the top margin of <body> to
	2% of my window height; the bottom
	margin of <body> to 2% of window
	height; the left margin of <body>
	to 20% of my window's width; and
	the right margin of <body>
	to 20% of my window's width.*/
	
	/*Remember that this:
	
		margin:10px 20px;
	
	really means this:
		Set margin-top and margin-bottom to 10px;
		Set margin-left and margin-right to 20px;
	
	but it can also look like this:
		margin: 10px 20px 10px 20px;
	
	Because when you don't use the full "margin-top:", "margin-left" format, the computer always reads the data in the following order:
		-top, -right, -bottom, -left;
	
	Which can be confusing.  Try thinking of it this way:  
			all values:
	1 value -> everything is the same;
			paired values:
	2 values -> top&bottom, and then left&right;
			clockwise values:
	4 values -> top, right, bottom, and left;
	*/
}

* {
	box-sizing: border-box;
	margin: 0px;
	padding: 0px;
}

h1 {
	font-size:2rem;
	text-transform:lowercase;
	color:white;
	background-color:black;
	padding:5px;
}

h2 {
	margin-top:35px;
}

strong code{
	background-color: firebrick;
	color: white;
	padding: 1px 5px;
	margin: 2px;
	border-radius: 3px;
}

p {
	line-height: 160%;
	margin-bottom:20px;
}

pre {
	background-color:black;
	color:orange;
	padding:12px;
	margin-bottom:40px;
}

code{

}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console