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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

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.

HTML

            
              		<main role="main" class="container">
			
			<h1>Magic Cross Browser CSS Grid</h1>
			<h2>Filling out with Todos from my Personal Bucket List</h2>
			
			<!--START GRIDWRAPPER-->
			<section class="gridwrapper">
				<div class="card">
					<div class="card-bg">
					<!--use picturefill for better cross browser support-->
					<figure>
            <img
                 srcset="https://image.ibb.co/ioNECa/gridcol.jpg 1x,
                         https://image.ibb.co/dBSxXa/gridcol_2x.jpg 2x"
                 src="https://image.ibb.co/ioNECa/gridcol.jpg"
                 alt="colosseum" width="100%" height="auto"/>
          </figure>

					<h3>Ancient Browers</h3>
					<p>Float based layout with pre-determined height on .card and max-height on p to make the cards line up. This can ofc. also be solved in different ways with js.</p>
					<a href="https://medium.com/@Frida/magic-cross-browser-css-grid-6fc6a359561d" class="calltoaction">read more</a>
					</div>
				</div><!--card-->

				<div class="card">
					<div class="card-bg">					
					<figure>
            <img src="https://image.ibb.co/ciKSXa/grideiff.jpg" srcset="https://image.ibb.co/ciKSXa/grideiff.jpg 1x, https://image.ibb.co/mjDAkv/grideiff_2x.jpg 2x" alt="eiffel tower" width="100%" height="auto"/></figure>
					<h3>Old Browers</h3>
					<p>Flexbox layout for browers that don't support CSS Grid. Remember to handle IE11 and IE10, who supports flexbox but not @supports.</p>
					<a href="https://medium.com/@Frida/magic-cross-browser-css-grid-6fc6a359561d" class="calltoaction">read more</a>
					</div>
				</div><!--card-->

				<div class="card">
					<div class="card-bg">
					<figure><img src="https://image.ibb.co/c4E5JF/gridmilan.jpg" srcset="https://image.ibb.co/c4E5JF/gridmilan.jpg 1x, https://image.ibb.co/d7j5JF/gridmilan_2x.jpg 2x" alt="vertical garden" width="100%" height="auto"/></figure>
					<h3>Modern Browers</h3>
					<p>CSS Grid layout with some flexbox addons for positioning elements within the cards.</p>
					<a href="https://medium.com/@Frida/magic-cross-browser-css-grid-6fc6a359561d" class="calltoaction">read more</a>
					</div>
				</div><!--card-->

				<div class="card">
					<div class="card-bg">
					<figure><img src="https://image.ibb.co/ghqedF/gridwhy.jpg" srcset="https://image.ibb.co/ghqedF/gridwhy.jpg 1x, https://image.ibb.co/eJiMsa/gridwhy_2x.jpg 2x" alt="books" width="100%" height="auto"/></figure>
					<h3>Dig Deeper</h3>
					<p>Read an in-depth article about the techniques used building this gallery.</p>
					<a href="https://medium.com/@Frida/magic-cross-browser-css-grid-6fc6a359561d" class="calltoaction">read more</a>
					</div>
				</div><!--card-->

				<div class="card">
					<div class="card-bg">
					<figure><img src="https://image.ibb.co/krzi5v/gridimg.jpg" srcset="https://image.ibb.co/krzi5v/gridimg.jpg 1x, https://image.ibb.co/bsTXyF/gridimg_2x.jpg 2x" alt="horse rider" width="100%" height="auto"/></figure>
					<h3>Riding in Tuscany</h3>
					<p>Riding holiday mixed with amazing food, antique masterpieces and unbelievably beautiful landscape scenery.</p>
					<a href="https://medium.com/@Frida/magic-cross-browser-css-grid-6fc6a359561d" class="calltoaction">read more</a>
					</div><!--card-bg-->
				</div><!--card-->

				<div class="card">
					<div class="card-bg">
					<figure><img src="https://image.ibb.co/d1L1sa/gridam.jpg" srcset="https://image.ibb.co/d1L1sa/gridam.jpg 1x, https://image.ibb.co/egg7Xa/gridam_2x.jpg 2x" alt="arena master" width="100%" height="auto"/></figure>
					<h3>Arena Master</h3>
					<p>If you don't know what it is, let's just say it's a nerd competition achievement. Once I was pretty good at World of Warcraft, a MMORPG.</p>
					<a href="https://medium.com/@Frida/magic-cross-browser-css-grid-6fc6a359561d" class="calltoaction">read more</a>
					</div>
				</div><!--card-->

				<div class="card">
					<div class="card-bg">
					<figure><img src="https://image.ibb.co/b9mrsa/griddp.jpg" srcset="https://image.ibb.co/b9mrsa/griddp.jpg 1x, https://image.ibb.co/e70HXa/griddp_2x.jpg 2x" alt="drinks" width="100%" height="auto"/></figure>
					<h3>Reviving the 1920s</h3>
					<p>Before social media witty remarks were delivered at Algonquin Hotel by Dorothy Parker. I'm pleased to report that drinks at the Algonquin are still served stiff.</p>
					<a href="https://medium.com/@Frida/magic-cross-browser-css-grid-6fc6a359561d" class="calltoaction">read more</a>
					</div>
				</div><!--card-->

				<div class="card">
					<div class="card-bg">
					<figure><img src="https://image.ibb.co/dxhECa/gridmasan.jpg" srcset="https://image.ibb.co/dxhECa/gridmasan.jpg 1x, https://image.ibb.co/fXonXa/gridmasan_2x.jpg 2x" alt="buildings in Masan" width="100%" height="auto"/></figure>
					<h3>Going back</h3>
					<p>Visiting the town in South Korea where I'm supposedly from was a very special experience.</p>
					<a href="https://medium.com/@Frida/magic-cross-browser-css-grid-6fc6a359561d" class="calltoaction">read more</a>
					</div>
				</div><!--card-->

			</section><!--gridwrapper-->
			<!--END GRIDWRAPPER-->
					
		</main><!--container-->
            
          
!

CSS

            
              body{
  text-align: center;
  font-family: "Roboto", "HelveticaNeue", Arial, Verdana, "Trebuchet MS", sans-serif;
  font-weight: 400;
  font-size: 16px;
  font-size: 1rem;
}

//GRIDWRAPPER------------------------------------------
	.gridwrapper{
		background-color:#fff5da;
		width:100%;
		display:block;
		margin:1em auto;
		max-width:71.875em;
		box-sizing:border-box;
		padding:1em;

		//adjusting padding, this will need to be cleared for grid
		@media only screen and (min-width: 30em) {
			padding:0.5em 0.5em 0 0.5em;
		}

	 	&:after{
	 		content: "";
	    	display: table;
	    	clear: both;
    }
	}//gridwrapper

//CARD--------------------------------------------------
	.card{
		//for browsers that don't flexbox or grid
		margin-bottom:1em;

		@media only screen and (min-width: 30em) {
			width:50%;
			float:left;
			display:inline-block;

			//adjusting padding, this will need to be cleared for grid
			box-sizing:border-box;
			padding:0.5em;
      
			//for browsers that don't flexbox or grid
			height: 440px;
			overflow:hidden;

			p{
				max-height: 67px;
				overflow:hidden;
			}
		}//mobile-landscape

		//@include breakpoint(mobile-large){
		@media only screen and (min-width: 56.25em) {
			width: 33.33%;
		}

		figure{
			margin:0;
			line-height: 0;
		}

		img{
			width: 100%;
			height:auto;
		}
	}//card

//CARD-BG: wraps around card contents, needed for older browsers if you want the image to appear full-width
	.card-bg{
		background-color:#FFF;
		height:100%;

		//for browsers that don't flexbox or grid
		position:relative;

	}//card-bg

//CALLTOACTION----------------------------------------------
	.calltoaction{
		display:inline-block;
		margin:auto auto 1.5em auto;

		//for browsers that don't flexbox or grid
		@media only screen and (min-width: 30em) {
    		position: absolute;
    		left: 50%;
    		bottom: 0;
    		transform: translateX(-50%);
		}//mobile-landscape
	}

//SUPPORTS FLEXBOX-----------------------------------------------
@supports( (display:flex) or (display: -webkit-flex) or (display: -webkit-flex) or (display: -moz-flex) or (display: -ms-flex) or (display: -o-flex) ){
        /*.card,*/ .card-bg{ //depending on if you need background color on the card or not
            display:flex;
            flex-direction:column;
            //flex:1 0 auto; //if you want any orphan cards fill out the width of the container
        }

        .calltoaction{
            margin:auto auto 1.5em auto;
        }

        @media only screen and (min-width: 30em) {
            .gridwrapper{
                display:flex;
                flex-direction:row;
                flex-wrap:wrap;
            }

            .calltoaction{ //resetting styles for browsers that don't support flexbox or grid
                position: static;
                left: initial;
                bottom:initial;
                transform: translateX(0);
            }

            .card{//resetting styles for browsers that don't support flexbox or grid
                height:auto;
                overflow:auto;
                margin-bottom: 0;

                p{
                    max-height: none;
                    overflow:auto;
                }
            }
        }//mobile-landscape
    }//supports

//SUPPORTS CSS GRID-----------------------------------------
    @supports(display:grid){
        .gridwrapper{
            display:grid;
            grid-template-columns:repeat(auto-fit, minmax(17.5em, 1fr));
            grid-gap:1em;

            //adjusting padding, this will need to be cleared for grid
            @media only screen and (min-width: 30em) {
                padding:1em;
            }
        }

        .card{
            width:auto;
            
            //resetting styles for browsers that don't support grid
            @media only screen and (min-width: 30em) {
			        padding:0;
			        margin-bottom:0;
            }
        }
    }//supports




//----------------------------------------------------------
//COSMETIC
	.calltoaction{
		background: #ff885e; /* Old browsers */
		background: -moz-linear-gradient(left, #ff885e 0%, #f33145 100%); /* FF3.6-15 */
		background: -webkit-linear-gradient(left, #ff885e 0%,#f33145 100%); /* Chrome10-25,Safari5.1-6 */
		background: linear-gradient(to right, #ff885e 0%,#f33145 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
		filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff885e', endColorstr='#f33145',GradientType=1 ); /* IE6-9 */
		color:#FFF;
		text-decoration:none;
		padding:0.5625em 1.125em 0.625em;
    border-radius:1.25em;

		&:hover, &:focus, &:active{
			cursor:pointer;
			&:after{
				opacity:1;
			}
		}

		&:after{
			content:'read more';
			position:absolute;
			width:100%;
			height: 100%;
			background: #f33145; /* Old browsers */
			background: -moz-linear-gradient(left, #f33145 0%, #ff5ea9 100%); /* FF3.6-15 */
			background: -webkit-linear-gradient(left, #f33145 0%,#ff5ea9 100%); /* Chrome10-25,Safari5.1-6 */
			background: linear-gradient(to right, #f33145 0%,#ff5ea9 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
			filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f33145', endColorstr='#ff5ea9',GradientType=1 ); /* IE6-9 */
			opacity:0;
			border-radius:1.25em;
			top: 0;
			left: 0;
			color:#FFF;
			text-align: center;
    		line-height:2.1875;
			transition:opacity 1s;
		}
	}

h1{
    font-family: 'Libre Baskerville', serif;
    text-align:center;
    background-image:linear-gradient(to right, #ff885d 0%,#ff5062 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: rgba(0, 0, 0, 0);  
    color:#2f2f2f;
    line-height: 1.25;
    display:inline-block;
    font-size:32px;
    font-size:2rem;    
    margin:2em auto 0.5em;
}

h2, h3{
    margin:0.5em 0;
    text-align:center;
}

h2{
    font-family: 'Libre Baskerville', serif;
    font-style:italic;
    font-weight: normal;
    font-size:18px;
    font-size: 1.125rem;
    color:#b37b69;
    color:#5f5f5f;
    margin:0.5em auto 1.3333em auto;
}

h3{
    font-family: 'Libre Baskerville', serif;
    font-weight: normal;
    font-style: italic;
    font-size: 23px;
    font-size: 1.4375rem;
    margin: 1.04348em 0em  0.78261em 0em;
    color:#2f2f2f;
}

p{
    line-height:1.4;
    margin:0 1em 1.75em 1em;
    color:#5f5f5f;
}
            
          
!

JS

            
              
            
          
!
999px

Console