Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialGina Bégin
Courses Plus Student 8,613 PointsIs there a way to shortcut proper typography in css?
With all the "proper" characters you're supposed to use and the coding that we have to enter in order to use it, there's gotta be a better way than having to hand-code all the special characters while you are creating page content. Is there any CSS code that will automatically replace things with the correct form of characters, such as opening and closing quotation marks, ampersands, ellipses, emdash, etc.? Seems like a hassle to have to look up the code (here, I've been told: http://www.impressivewebs.com/html-entity-reference-common) every time you want to put the correct character in.
Gina Bégin
Courses Plus Student 8,613 PointsNo problem, Shawn! Can't claim that it was my find (it was listed in the course). I'm glad I'm not the only one wondering this, though.
2 Answers
William Whitworth
6,117 PointsHmm, this seems like something that you would have to do server side, before the page is delivered to the client. PHP seems to have a function for it:
http://php.net/manual/en/function.htmlspecialchars.php
Maybe Haml has a solution as well. http://haml.info/about.html
Alternatively, you could use Javascript:
http://css-tricks.com/snippets/javascript/htmlentities-for-javascript/
Robert Manolis
Treehouse Guest Teacheryou can add some things to your markup through css files with pseudo-selectors.
example::after { content: "&,@,?,etc..."; }
Robert Manolis
Treehouse Guest TeacherNot sure if that's any easier though. :)
Shawn Denham
Python Development Techdegree Student 17,801 PointsShawn Denham
Python Development Techdegree Student 17,801 PointsCurious on this one myself! and thanks for the link Gina!