Skip to content

Instantly share code, notes, and snippets.

@yonbergman
Created November 2, 2011 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yonbergman/1333205 to your computer and use it in GitHub Desktop.
Save yonbergman/1333205 to your computer and use it in GitHub Desktop.
Dynamically Shrinking Titles
# insert this somewhere right after document.load
@header = $('.header')
while (@header.height() > @header.parent().height())
currentFontSize = parseInt(@header.css("font-size"))
@header.css("font-size", currentFontSize - 1)
.header-wrapper
%h1.header= @title # dynamic title text
$title-width: 560px;
$title-height: 50px;
$title-font-size: 28px;
.header-wrapper{
width: $title-width;
height: $title-height;
overflow:hidden;
.header{
line-height: $title-height;
font-size: $title-font-size;
font-weight: bold;
//..... other stylings
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment