cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-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.

  %h1.retxt="Responsive to<br/> the <br/> Screen"

              body{background:#222;margin:0; padding:0; color:#DDD}
.container{width:100%; text-align:center;float:left}
h1{text-transform:uppercase;margin:0; padding:0} 
              // Textsive
  //Text + Responsive. Its not that clever huh?
  $.fn.textsive = function(options){
    //Accept Options
    var settings = $.extend({
    //Return all instances
    return this.each(function(){
      var $this = $(this);
      //Regex finding all the <BR> <br> <br/> \r \n to determine line-breaks
      var newLines = $this.html().trim().split(/[\r\n]|<br\s*[\/]?>/gi);
      var nLines = [];
      //Clear out the original bit of text. I might need to make a less destructive method
      //Now that the text has been broken into its lines we need to wrap it in a block object to later detect the width. 
      for(var i = 0; i < newLines.length; i++){
        nLines[i] = ("<div>"+newLines[i]+"</div>");        
      //Throw it back in now that "new lines" have been broken into full blocks
      //So heres the function that gets called whenever the window is resized.
      //Already setup the "line-breaks" so we don't have to reconstruct those
      var resizeMe = function(){        
        /*So the thought here is to take the width of the container divided
        by the number of characters. Instead of the text being uniformly the
        the same size  I can get that nice scale variance where the characters
        form a block. Clamping function for some control, but I like it without.
          var c = ($(this).width() / $(this).text().trim().length)*settings.scale ;
              fontSize:  Math.min(Math.max(c, settings.minFontSize), settings.maxFontSize),
              lineHeight: settings.lineHeight +"em"

$("h1").textsive({lineHeight:0.85, scale:1.1}); 

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