A Pen by Andrew Kirchmyer on CodePen.
Created
November 17, 2013 03:18
-
-
Save akirchmyer/7508620 to your computer and use it in GitHub Desktop.
A Pen by Andrew Kirchmyer.
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 characters
| Font: | |
| <button class="font plus">+</button> | |
| <button class="font minus">-</button>Padding: | |
| <button class="padding plus">+</button> | |
| <button class="padding minus">-</button> | |
| <div class="mydiv"> | |
| <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p> | |
| </div> |
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 characters
| $('.font.plus').click(function () { | |
| var font = parseInt($('.mydiv').css('font-size'), 10); | |
| $('.mydiv').css('font-size', font + 1 + 'px'); | |
| }); | |
| $('.font.minus').click(function () { | |
| var font = parseInt($('.mydiv').css('font-size'), 10); | |
| $('.mydiv').css('font-size', font - 1 + 'px'); | |
| }); | |
| $('.padding.plus').click(function () { | |
| var padding = parseInt($('.mydiv').css('padding'), 10); | |
| $('.mydiv').css('padding', padding + 5 + 'px'); | |
| }); | |
| $('.padding.minus').click(function () { | |
| var padding = parseInt($('.mydiv').css('padding'), 10); | |
| $('.mydiv').css('padding', padding - 5 + 'px'); | |
| }); |
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 characters
| .mydiv { | |
| padding: 10px; | |
| line-height: 1.5; | |
| /** creates the lines **/ | |
| background-image: linear-gradient(black 1px, transparent 1px); | |
| /** Background is equal to line height **/ | |
| background-size: 100% 1.5em; | |
| /** Positions the lines **/ | |
| background-position: 0 0.8em; | |
| /** rather than default of padding-box, content-box positions the background in relation to the content. This allows padding to change without the lines being offset **/ | |
| background-origin: content-box; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment