CodePen

HTML

            
              <!--

-->

<section>
  <div>
    <div class="small">1</div>
    <div class="medium">2</div>
    <div class="large">3</div>
    <div class="medium">4</div>
    <div class="small">5</div>
  </div>
</section>
            
          
!

↑ Insert the most common viewport meta tag

CSS

            
              /******************
* Layout specific
*******************/
@media screen and (max-width: 699px) {
  body {
    min-width: 30rem;
    width: auto !important;
    width: 30rem;
    padding: 1rem;
    
    > section {
      width: 28rem; // (420px - (2 * 14px)) / 14px;
      
      > div {
        width: 29rem;
        
        > div {
          width: 28rem;
        }
      }
    }
  }
}

@media screen and (min-width: 700px) {
  body {
    min-width: 70rem;
    width: auto !important;
    width: 70rem;
    padding: 2rem;
    
    > section {
      width: 66rem; // (980px - (2 * 28px)) / 14px;
        
      > div {
        width: 67rem;
        
        > div {
          height: 20rem;
          
          &.small {
            width: 20rem;
          }
        
          &.medium {
            width: 45rem;
          }
        
          &.large {
            width: 66rem;
          }
        }
      }
    }
  }
}

/******************
* Basic CSS
*******************/
* {
  box-sizing: border-box;
}

body {
  overflow-x: hidden;
  background-color: #333;
  color: #fff;
  text-align: center;
  
  > section {
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    font-size: 0;

    > div {
      > div {
        display: inline-block;
        margin: 0 1rem 1rem 0;
        background-color: #666;
        font-size: 10rem;
        line-height: 20rem;
      }
    }
  }
}
            
          
!
? ?
? ?
Must be a valid URL.
+ add another resource
via CSS Lint

JS

            
              ;(function(window, document, undefined) {
	'use strict';

	var	htmlElement     = document.getElementsByTagName('html')[0],
		documentElement = document.documentElement,
		layouts = {
			mobile: {
				width: 420,
				base: 14,
				min: 10,
				max: 23,
				breakpoint: 420 * (10 / 14)
			},
			desktop: {
				width:      980,
				base:       14,
				min:        10,
				max:        18,
				breakpoint: 980 * (10 / 14)
			}
		},
		state = {
			size:   null,
			layout: null
		};

	function updateFontsize() {
		var width, id, layout, current, size;

		width = documentElement.offsetWidth;

		for(id in layouts) {
			if(layouts[id].breakpoint && width >= layouts[id].breakpoint) {
				layout = id;
			}
		}

		if(layout !== state.layout) {
			state.layout = layout;

			htmlElement.setAttribute('data-layout', layout);
		}

		current = layouts[state.layout];

		size = Math.max(current.min, Math.min(current.max, Math.floor(current.base * (width / current.width))));

		if(size !== state.size) {
			state.size = size;

			htmlElement.style.fontSize = size + 'px';
		}
	}

	window.addEventListener('resize', updateFontsize, false);
	window.addEventListener('orientationchange', updateFontsize, false);

	updateFontsize();
}(window, document));
            
          
!
Must be a valid URL.
+ add another resource
via JS Hint
Loading ..................