JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
<body lang=en><!-- lang required for hyphenation rules -->
<h1>Automatic Hyphenation with Element Queries</h1>
<h2>✔︎ Safari, ✔︎ Firefox, ✘ Chrome</h2>
<blockquote>
<q>Another use case for element queries: disable hyphenation when measure is wide enough.</q>
<cite><a href=https://twitter.com/johndjameson/status/781206718445420546 target=_blank>@johndjameson</a></cite>
</blockquote>
<p>This demo assumes you <em>don’t</em> especially want your headlines to be hyphenated. It's good to be able to turn that feature on when an element needs it, but it would be nice to be able to turn it off as soon as an element is wide enough to display words without hyphens.</p>
<p>The styles in the CSS panel includes 1 rule that turns on hyphens for all heading tags, and then an element query for the same heading elements containing 1 rule that will disable this property on any heading more than 25 ems wide.</p>
<!-- Sample Headlines -->
<h2>Inconceivably Elongated Categorization</h2>
<h3>Incredulously Verbose Supporting Subheadline</h3>
<h4>Nonsensically Preposterous Tommyrot</h4>
h1,h2,h3,h4,h5,h6 {
-webkit-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
}
@element h1, h2, h3, h4, h5, h6 and (min-width: 25em) {
$this {
-webkit-hyphens: none;
-moz-hyphens: none;
hyphens: none;
}
}
Also see: Tab Triggers