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.

            
              <article class="explain">
	<p>Stylus version of <a href="https://codepen.io/diana_aceves/pen/KVGNZg" target="_blank">the @diana_aceves mixin</a> to fix problems with the last row items in a flexbox grid with <code>justify-content: space-between</code>.</p>
	<p>Adaptación a Stylus del <a href="https://codepen.io/diana_aceves/pen/KVGNZg">Mixin creado por @diana_aceves</a> para arreglar los items huérfanos en un grid con flexbox y space-between.</p>
</article>
<ul class="flexlist">
	<li class="item">Item#01</li>
	<li class="item">Item#02</li>
	<li class="item">Item#03</li>
	<li class="item">Item#04</li>
	<li class="item">Item#05</li>
	<li class="item">Item#06</li>
	<li class="item">Item#07</li>
	<li class="item">Item#08</li>
	<li class="item">Item#09</li>
	<li class="item">Item#10</li>
</ul>
            
          
!
            
              /*! _____ Functions ____ */
love-between(numcols, itemswidth)
	/* Establecer el ancho de los flex items */
	flex 0 1 itemswidth
	/* Calcular espacio entre flex items */
	filledspace = itemswidth * numcols
	marginspace = 100% - filledspace
	numcolsminus = numcols - 1
	flexmargin = "calc(%s / %s)" % (marginspace numcolsminus)
	/* Aplicar margen izquierdo a los items de la última fila (excepto al primero) */
	&:nth-child({numcols}n+1):nth-last-child(-n+{numcolsminus}) ~ .item
		margin-left "calc(%s / %s)" % (marginspace numcolsminus)
	
	/* Aplicar margin-right auto al último item */
	for i in (1..(numcols - 2))
		index = numcols - i
		&:nth-child({numcols}n+{index}):last-child
			margin-right auto
	/* Marcar los items huérfanos de la últia fila */
	&:nth-child({numcols}n+1):nth-last-child(-n+{numcolsminus})
	&:nth-child({numcols}n+1):nth-last-child(-n+{numcolsminus}) ~ .item
		background teal

/*! _____ Styles ____ */
*
*::before
*::after
*:before
*:after
	box-sizing border-box
	font-family sans-serif

.explain
	max-width 600px
	color #7a7a7a
	margin 0 auto 2rem
	padding .5rem .5rem .5rem 1rem
	border-left 3px solid lightgray
	background #eaeaea
	a
		color #5f5f5f
	
.flexlist
	display flex
	flex-flow row wrap
	justify-content space-between
	list-style none
	padding 0
	.item
		text-transform uppercase
		text-align center
		color white
		margin-bottom 2%
		padding 2rem 2%
		background-color turquoise
		word-break break-word
		love-between(4, 23%)
		
            
          
!
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