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

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

CSS

              
                /*! _____ 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%)
		
              
            
!

JS

              
                
              
            
!
999px

Console