Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <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>
              
            
!

CSS

              
                

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{

}
              
            
!

JS

              
                
              
            
!
999px

Console