-
-
Save lanceosborne/7dea4f06ee10e699b23c to your computer and use it in GitHub Desktop.
Revisions
-
alessandroraffa revised this gist
Oct 24, 2013 . 1 changed file with 7 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ /*! * fluid-ratio.css * Version: 0.1.1 * * @author Alessandro Raffa <contact@alessandroraffa.eu> * @@ -14,8 +14,8 @@ overflow:hidden; } .ratio-1-1{ padding-bottom: 100%; /* value for 1:1 aspect ratio */ } .ratio-4-3{ @@ -26,6 +26,10 @@ padding-bottom: 66.6666667%; /* value for 3:2 aspect ratio */ } .ratio-16-9{ padding-bottom: 56.25%; /* value for 16:9 aspect ratio */ } .ratio-3-1{ padding-bottom: 33.3333333%; /* value for 3:1 aspect ratio */ } -
alessandroraffa created this gist
Oct 24, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ /*! * fluid-ratio.css * Version: 0.1.0 * * @author Alessandro Raffa <contact@alessandroraffa.eu> * */ .fluid-ratio{ position:relative; margin:0; padding:0; height:0; overflow:hidden; } .ratio-16-9{ padding-bottom: 56.25%; /* value for 16:9 aspect ratio */ } .ratio-4-3{ padding-bottom: 75%; /* value for 4:3 aspect ratio */ } .ratio-3-2{ padding-bottom: 66.6666667%; /* value for 3:2 aspect ratio */ } .ratio-3-1{ padding-bottom: 33.3333333%; /* value for 3:1 aspect ratio */ } .fluid-ratio > :first-child{ position: absolute; top: 0; left: 0; width: 100%; height: 100%; margin:0; } /************ Usage <div class="fluid-ratio ratio-16-9"> <div>This element has 16:9 aspect ratio width fluid width</div> </div> ************/