cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

              <article class="container">
<section><h1>Whats responssive typogrophy?</h1><p>Its when teh size of yuor font chnages with the wdith of the broewsr. try chagning this pens farme size and you'll see the fnot getting smalelr with it.</p></section>
<section class="pull-left">
  <div class="col-xs-12 col-sm-6">
  <h2>How does it do this?</h2>
  <p>There's a couple steps, but mainly you want your font sizes expressed in <i>rem</i> units.  Not px or em - but <strong>rem</strong>.</p>
  <p>Rem stands for <em>root</em>-em.  The relative size of the font is tied to the size of the root (a.k.a. the HTML element).</p>
    <p>This technique can also be applied to a bunch of stuff like padding (as it is here), line-heights, and even images.</p>
<div class="col-xs-12 col-sm-offset-1 col-sm-5">
  <h3>Fun facts</h3>
    <li>A study at Cambridge University determined that words whose letters had been scrambled, except for the first and last, are read just as fast as the unscrambled version.</li>
    <li>That study actually never existed and was just a misinterpreted letter from a professor.</li>
    <li>It still seems true nonetheless though, eh?</li>
<section class="col-xs-12">
  <h2>Why not just use em?</h3>
  <p>Using 'em' units can be difficult because how big   '1 em' is will always be changing.  A single 'em' is just the current font-size of the parent element, so you will need to keep multiply to get different font sizes. The issue becomes more apparent when you are nesting elements.</p>
  <div class="example">
  <div class="example-heading">
    <span>This section uses 'em' instead of 'rem'</span>
  <div class="example-body">  
    <p style="font-size: 1em">This element starts as 1em... 
    <span style="font-size: 2em">and has a nested 2em followed by... 
      <span style="font-size: 0.75em">a nested 0.75em element.</span></span></p>
  <p>In the example, the 0.75em element ends up being with a larger font size than the parent element which is 1em.  This may be easy to keep track of with just two nested elements, but 6 or 8 deep and see how it goes.</p>
              $base-font-size: 16; //will translate to 16px when html font-size is 62.5%
$h1-font-size: 40;
$h2-font-size: 26;

$base-line-height: 1.4em;
$base-pad-size: 20;

@function rem-sizing($target-size){
		@return ($target-size / 10);

@mixin font-size($font-size: $base-font-size) {
	font-size: ($font-size) + px;
	font-size: rem-sizing($font-size) + rem;	

@mixin line-height($line-height: $base-line-height) {
	line-height: ($line-height) + px;
	line-height: rem-sizing($line-height) + rem;	

@mixin text-padding($text-padding: $base-pad-size, $pad2: false, $pad3: false, $pad4: false) {
	@if $pad4 {	
		padding: ($text-padding) + px ($pad2) + px ($pad3) + px ($pad4) + px;
		padding: rem-sizing($text-padding) + rem rem-sizing($pad2) + rem rem-sizing($pad3) + rem rem-sizing($pad4) + rem;
	} @else if $pad3 {
		padding: ($text-padding) + px ($pad2) + px ($pad3) + px;
		padding: rem-sizing($text-padding) + rem rem-sizing($pad2) + rem rem-sizing($pad3) + rem;
	} @else if $pad2 {
		padding: ($text-padding) + px ($pad2) + px;
		padding: rem-sizing($text-padding) + rem rem-sizing($pad2) + rem;
	} @else {
		padding: ($text-padding) + px;
		padding: rem-sizing($text-padding) + rem;

@mixin padding($side, $padAmount: $base-pad-size) {
	padding-#{$side}: ($padAmount) + px;
	padding-#{$side}: rem-sizing($padAmount) + rem;	

	@include font-size(20);
  line-height: $base-line-height;

  @include font-size(18);
  @include padding(bottom,5);
  list-style: square;
  line-height: $base-line-height;

	@include font-size($h1-font-size);	

	@include font-size($h2-font-size);
	@include text-padding(0,0,10);

  @include font-size(24);
  font-weight: 200;

  background: rgba(230,230,230,0.25);
  @include text-padding(10,50);

  border-top:1px solid black;
  border-bottom:1px solid #ddd;
  @include text-padding(30);

    background: url('https://i.imgur.com/KBfRhVq.png');
  box-shadow: -1px -1px 5px #000;
  @include text-padding(10,10,5,10);
  background: rgba(201, 104, 104, 0.7);
  color: white;
  @include text-padding(20);
  margin-bottom: 20px;

  background: url('https://i.imgur.com/v3cosn3.png'); 

	html{font-size: 45%;}

@media (min-width: 768px) {
	html{font-size: 55%;}
    @include padding(bottom,15);
    line-height: 1.5em;
    @include padding(bottom,10);

@media (min-width: 992px) {
	html{font-size: 62.5%;}

@media (min-width: 1200px) {
	html{font-size: 72%;}

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.


Loading ..................