HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<header>
<div class="overlay"></div>
<div class="contained">
<nav class="top-nav">
<div class="logo">
<a href="/">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 200 130" style="enable-background:new 0 0 200 130;" xml:space="preserve">
<g>
<path style="fill:#FFFFFF;" d="M94.744,2.25c-0.192,2.64-0.792,5.112-1.8,7.416c-0.432,1.008-0.997,2.016-1.692,3.024 c-0.696,1.008-1.524,1.956-2.484,2.844c-0.961,0.889-2.088,1.692-3.384,2.412c-1.296,0.72-2.808,1.296-4.536,1.728 c-2.16,0.529-4.561,0.601-7.2,0.216c-2.64-0.383-5.448-1.031-8.424-1.944c-1.537,1.249-3.085,3.108-4.644,5.58 c-1.561,2.473-3.145,5.292-4.752,8.46c-1.609,3.168-3.265,6.552-4.968,10.152c-1.704,3.6-3.517,7.189-5.436,10.764 c-1.92,3.576-3.936,7.02-6.048,10.332c-2.113,3.312-4.392,6.228-6.84,8.749c-2.448,2.52-5.065,4.535-7.848,6.047 c-2.784,1.513-5.785,2.269-9,2.269c-4.081,0-7.249-0.804-9.504-2.412c-2.257-1.608-3.756-3.636-4.5-6.084s-0.816-5.076-0.216-7.884 c0.6-2.808,1.716-5.436,3.348-7.884c1.631-2.448,3.683-4.475,6.156-6.084c2.472-1.607,5.195-2.412,8.172-2.412 c1.392,0,2.423,0.313,3.096,0.936c0.671,0.625,1.067,1.404,1.188,2.34c0.119,0.936-0.025,1.944-0.432,3.024 c-0.409,1.08-1.033,2.088-1.872,3.024c-0.84,0.936-1.849,1.717-3.024,2.34c-1.177,0.624-2.46,0.936-3.852,0.936 c-1.344,0-2.28-0.457-2.808-1.368c-0.529-0.912-0.648-2.063-0.36-3.456c-1.92,1.825-3.348,3.924-4.284,6.3 s-1.321,4.632-1.152,6.768c0.167,2.136,0.923,3.948,2.268,5.437c1.343,1.486,3.312,2.231,5.904,2.231
c2.352,0,4.5-0.732,6.444-2.196c1.944-1.465,3.792-3.42,5.544-5.867c1.751-2.449,3.42-5.269,5.004-8.46 c1.584-3.192,3.179-6.516,4.788-9.972c1.607-3.456,3.287-6.912,5.04-10.368c1.751-3.456,3.636-6.671,5.652-9.648 c2.016-2.976,4.223-5.604,6.624-7.884c2.399-2.279,5.063-3.948,7.992-5.004c-2.784-0.911-5.592-1.883-8.424-2.916 c-2.833-1.032-5.592-1.919-8.28-2.664c-2.689-0.744-5.245-1.271-7.668-1.584c-2.425-0.312-4.644-0.228-6.66,0.252 c-2.113,0.529-3.864,1.344-5.256,2.448c-1.393,1.105-2.448,2.316-3.168,3.636c-0.72,1.321-1.105,2.641-1.152,3.96 c-0.048,1.321,0.204,2.484,0.756,3.492c0.551,1.008,1.392,1.752,2.52,2.232c1.127,0.48,2.531,0.504,4.212,0.072
c0.191-0.096,0.335-0.191,0.432-0.288l0.144-0.144c-1.393,0.097-2.34-0.372-2.844-1.404C25.012,22.71,25,21.378,25.48,19.746 c0.528-1.775,1.332-3.204,2.412-4.284s2.34-1.667,3.78-1.764c0.672-0.047,1.343,0.097,2.016,0.432 c1.055,0.625,1.751,1.5,2.088,2.628c0.335,1.128,0.36,2.34,0.072,3.636c-0.288,1.296-0.84,2.569-1.656,3.816 c-0.816,1.249-1.836,2.28-3.06,3.096c-1.224,0.817-2.592,1.345-4.104,1.584c-1.512,0.241-3.108,0-4.788-0.72 c-2.16-0.912-3.625-2.412-4.392-4.5c-0.769-2.088-0.828-4.272-0.18-6.552c0.648-2.279,2.003-4.416,4.068-6.408 c2.063-1.991,4.824-3.348,8.28-4.068c2.063-0.432,4.295-0.527,6.696-0.288c2.4,0.241,4.92,0.624,7.56,1.152 c2.639,0.529,5.411,1.104,8.316,1.728c2.904,0.625,5.879,1.128,8.928,1.512c3.047,0.385,6.167,0.565,9.36,0.54
c3.191-0.023,6.419-0.443,9.684-1.26c1.631-0.432,3.096-1.032,4.392-1.8c1.296-0.767,2.412-1.607,3.348-2.52 c0.936-0.911,1.692-1.823,2.268-2.736c0.576-0.911,0.96-1.703,1.152-2.376L94.744,2.25z M64.072,53.298 c-0.385,1.008-0.432,1.8-0.144,2.376c0.288,0.576,0.983,0.864,2.088,0.864h0.72l-1.512,3.096c-0.385,0.096-0.792,0.191-1.224,0.288 c-0.72,0.144-1.609,0.216-2.664,0.216c-2.736,0-4.44-0.744-5.112-2.232c-0.673-1.487-0.36-3.816,0.936-6.984l9.216-22.392 c0.432-0.959,0.504-1.739,0.216-2.34c-0.288-0.6-0.984-0.9-2.088-0.9h-0.72l1.512-3.096c0.384-0.047,0.792-0.119,1.224-0.216 c0.384-0.096,0.792-0.168,1.224-0.216c0.432-0.047,0.911-0.072,1.44-0.072c2.736,0,4.452,0.745,5.148,2.232 c0.695,1.488,0.371,3.864-0.972,7.128l-1.008,2.448c0.959-0.623,1.955-1.104,2.988-1.44c1.032-0.335,2.052-0.504,3.06-0.504
c2.304,0,3.912,0.781,4.824,2.34c0.911,1.561,0.767,3.829-0.432,6.804l-4.68,11.304c-0.336,0.912-0.264,1.56,0.216,1.944 c0.479,0.385,1.127,0.504,1.944,0.36c0.815-0.144,1.703-0.576,2.664-1.296c0.959-0.72,1.751-1.728,2.376-3.024l1.224,2.016 c-0.48,1.152-1.141,2.221-1.98,3.204c-0.84,0.984-1.776,1.836-2.808,2.556c-1.033,0.72-2.136,1.296-3.312,1.728 c-1.177,0.432-2.34,0.648-3.492,0.648c-1.152,0-2.148-0.192-2.988-0.576c-0.84-0.384-1.465-0.96-1.872-1.728 c-0.408-0.768-0.588-1.728-0.54-2.88c0.047-1.152,0.384-2.472,1.008-3.96l4.68-11.232c0.288-0.72,0.312-1.271,0.072-1.656 c-0.241-0.384-0.637-0.612-1.188-0.684c-0.553-0.072-1.188,0.036-1.908,0.324c-0.72,0.288-1.44,0.745-2.16,1.368L64.072,53.298z"/>
<path style="fill:#FFFFFF;" d="M99.136,56.106c1.008,0,2.052-0.168,3.132-0.504c1.08-0.335,2.111-0.779,3.096-1.332 c0.983-0.551,1.884-1.2,2.7-1.944c0.815-0.744,1.487-1.523,2.016-2.34l1.225,2.016c-1.2,2.544-3.265,4.536-6.192,5.976 c-2.928,1.44-6.336,2.16-10.224,2.16c-2.016,0-3.733-0.372-5.148-1.116c-1.417-0.744-2.509-1.764-3.276-3.06 c-0.768-1.296-1.175-2.819-1.224-4.572c-0.047-1.751,0.312-3.611,1.08-5.58c1.824-4.655,4.259-8.195,7.308-10.62 c3.048-2.423,6.419-3.636,10.116-3.636c1.968,0,3.456,0.517,4.465,1.548c1.008,1.033,1.571,2.281,1.691,3.744 c0.119,1.465-0.192,3.024-0.936,4.68c-0.745,1.656-1.885,3.132-3.42,4.428c-2.16,1.776-4.657,2.664-7.488,2.664h-4.608 c-0.625,2.16-0.396,3.949,0.684,5.364C95.211,55.398,96.879,56.106,99.136,56.106z M101.943,34.794 c-0.48,0.192-1.044,0.624-1.692,1.296c-0.648,0.673-1.308,1.512-1.98,2.52c-0.673,1.008-1.357,2.136-2.052,3.384 c-0.697,1.249-1.309,2.545-1.836,3.888h2.52c1.104,0,2.04-0.335,2.808-1.008c0.768-0.672,1.488-1.704,2.16-3.096 c0.576-1.055,1.032-2.063,1.368-3.024c0.336-0.96,0.528-1.775,0.576-2.448c0.047-0.671-0.072-1.163-0.36-1.476 C103.168,34.518,102.663,34.506,101.943,34.794z"/>
</g>
<g>
<path style="fill:#FFFFFF;" d="M66.396,94.448c1.68,0.24,3.323,0.756,4.932,1.548c1.607,0.792,3.204,1.74,4.788,2.844
c2.927-2.783,5.963-6.036,9.108-9.756c3.143-3.72,6.408-7.524,9.792-11.412c3.384-3.888,6.887-7.668,10.511-11.34 c3.625-3.672,7.368-6.888,11.232-9.648c3.863-2.759,7.859-4.86,11.988-6.3c4.128-1.44,8.376-1.872,12.744-1.296 c2.304,0.336,4.151,1.044,5.544,2.124c1.392,1.08,2.315,2.34,2.771,3.78s0.407,2.952-0.144,4.536
c-0.553,1.584-1.62,3.024-3.204,4.32c-1.104,0.913-2.148,1.609-3.132,2.088c-0.984,0.48-1.885,0.816-2.7,1.008 c-0.816,0.193-1.512,0.265-2.088,0.217s-1.033-0.145-1.368-0.289c-1.345-0.575-1.992-1.463-1.944-2.663 c0.048-1.2,0.672-2.423,1.872-3.672c1.44-1.487,2.94-2.459,4.5-2.916c1.56-0.456,3.035-0.371,4.429,0.252 c0.384,0.097,0.647,0.265,0.792,0.504c0.288-0.479,0.348-1.032,0.18-1.656c-0.169-0.623-0.504-1.199-1.008-1.728 c-0.504-0.527-1.177-1.008-2.017-1.44s-1.788-0.72-2.844-0.864c-2.928-0.384-5.856,0.252-8.784,1.908 c-2.928,1.656-5.903,3.96-8.928,6.912c-3.023,2.952-6.096,6.348-9.216,10.188c-3.121,3.841-6.336,7.74-9.647,11.7 c-3.312,3.96-6.697,7.789-10.153,11.484c-3.456,3.696-7.032,6.864-10.728,9.504c1.631,1.248,3.372,2.495,5.22,3.744 c1.847,1.247,3.816,2.412,5.904,3.492c2.088,1.08,4.344,2.027,6.769,2.844c2.423,0.815,5.051,1.415,7.884,1.8
c1.774,0.239,3.468,0.228,5.075-0.036c1.608-0.264,3.049-0.66,4.32-1.188c1.271-0.529,2.364-1.129,3.276-1.8 c0.911-0.673,1.607-1.297,2.088-1.872l2.304,2.88c-1.248,2.543-2.832,4.752-4.752,6.624c-0.816,0.815-1.764,1.571-2.844,2.268 c-1.08,0.695-2.28,1.296-3.6,1.8c-1.321,0.504-2.762,0.852-4.32,1.044c-1.561,0.191-3.275,0.145-5.148-0.144
c-2.304-0.337-4.561-1.152-6.768-2.448c-2.208-1.296-4.381-2.844-6.516-4.644c-2.136-1.8-4.237-3.744-6.3-5.832 c-2.064-2.088-4.129-4.116-6.192-6.084c-2.88,1.68-5.785,2.903-8.712,3.672c-2.928,0.768-5.976,0.936-9.144,0.504 c-2.497-0.336-4.489-1.044-5.976-2.124c-1.488-1.08-2.52-2.293-3.096-3.636c-0.576-1.344-0.708-2.724-0.396-4.141 c0.312-1.415,1.044-2.675,2.196-3.779c1.152-1.104,2.688-1.944,4.608-2.521C61.475,94.231,63.756,94.112,66.396,94.448z M60.492,106.832c2.016,0.288,4.104-0.072,6.264-1.08c2.16-1.008,4.392-2.495,6.696-4.464c-1.393-0.96-2.785-1.765-4.176-2.412 c-1.393-0.648-2.784-1.092-4.176-1.332c-2.497-0.335-4.477-0.096-5.94,0.72c-1.465,0.816-2.389,1.825-2.772,3.024 c-0.385,1.2-0.241,2.364,0.432,3.492C57.492,105.907,58.716,106.591,60.492,106.832z"/>
<path style="fill:#FFFFFF;" d="M135.012,76.304c1.729,0,3.18,0.372,4.355,1.116s2.027,1.764,2.557,3.06
c0.527,1.296,0.742,2.809,0.648,4.536c-0.098,1.729-0.529,3.576-1.297,5.544c-0.863,2.257-1.92,4.261-3.168,6.013 s-2.629,3.252-4.141,4.5s-3.121,2.195-4.824,2.844c-1.703,0.647-3.467,0.972-5.291,0.972c-1.777,0-3.24-0.372-4.393-1.116 c-1.152-0.743-1.992-1.764-2.52-3.06s-0.731-2.819-0.612-4.572c0.12-1.752,0.563-3.611,1.332-5.58 c1.823-4.56,4.235-8.075,7.235-10.548C127.895,77.54,131.268,76.304,135.012,76.304z M133.211,90.668 c0.576-1.483,1.045-2.895,1.404-4.234c0.359-1.339,0.588-2.523,0.684-3.552s0.047-1.854-0.143-2.477 c-0.193-0.622-0.576-0.934-1.152-0.934s-1.225,0.312-1.945,0.934c-0.719,0.622-1.451,1.448-2.195,2.477s-1.477,2.213-2.195,3.552 c-0.721,1.34-1.369,2.751-1.945,4.234c-0.576,1.436-1.057,2.811-1.439,4.126c-0.385,1.316-0.611,2.477-0.684,3.481 c-0.072,1.004,0.012,1.806,0.252,2.403c0.24,0.599,0.648,0.897,1.225,0.897c0.574,0,1.211-0.299,1.906-0.897
c0.695-0.598,1.404-1.399,2.125-2.403c0.721-1.005,1.439-2.165,2.16-3.481C131.988,93.479,132.635,92.104,133.211,90.668z"/>
<path style="fill:#FFFFFF;" d="M174.684,76.88c-0.385,0.912-0.816,1.969-1.296,3.168c-0.48,1.2-1.008,2.484-1.584,3.852 c-0.576,1.368-1.152,2.785-1.728,4.248c-0.576,1.465-1.152,2.893-1.729,4.284c-1.344,3.265-2.736,6.673-4.176,10.225 c-1.825,4.655-4.248,8.208-7.272,10.655c-3.023,2.448-6.384,3.672-10.08,3.672c-1.536,0-2.761-0.359-3.672-1.08 c-0.911-0.72-1.548-1.632-1.907-2.735c-0.36-1.104-0.433-2.329-0.217-3.672c0.217-1.345,0.685-2.664,1.404-3.96 c0.673-1.105,1.44-2.063,2.304-2.88c-1.008-1.297-1.512-2.988-1.512-5.076s0.527-4.429,1.584-7.021 c2.111-4.896,4.704-8.496,7.776-10.8c3.071-2.304,6.264-3.456,9.576-3.456c1.774,0,3.143,0.624,4.104,1.872l0.504-1.296H174.684z M149.916,104.888c-0.576,0-1.104-0.048-1.584-0.144c-0.48-0.097-0.937-0.217-1.368-0.36c-0.673,0.479-1.296,1.176-1.872,2.088 c-0.576,0.911-1.033,2.063-1.368,3.456c-0.239,1.199-0.061,2.147,0.54,2.844c0.6,0.695,1.379,1.044,2.34,1.044 c0.911,0,1.824-0.323,2.736-0.972c0.911-0.648,1.787-1.501,2.628-2.556c0.839-1.057,1.607-2.245,2.304-3.564 c0.695-1.32,1.284-2.628,1.765-3.924c-1.057,0.673-2.101,1.188-3.132,1.548C151.871,104.708,150.875,104.888,149.916,104.888z M153.084,100.352c0.72,0,1.499-0.203,2.34-0.611c0.839-0.407,1.692-0.947,2.556-1.62l7.057-17.137 c-0.48-0.575-1.152-0.863-2.017-0.863c-0.863,0-1.691,0.18-2.483,0.54c-0.792,0.359-1.584,0.936-2.376,1.728 s-1.597,1.836-2.412,3.132c-0.817,1.296-1.681,2.88-2.592,4.752c-0.721,1.393-1.285,2.7-1.692,3.924 c-0.408,1.225-0.637,2.293-0.684,3.204c-0.049,0.913,0.107,1.633,0.468,2.16C151.607,100.089,152.22,100.352,153.084,100.352z"/>
<path style="fill:#FFFFFF;" d="M190.523,76.304c1.729,0,3.18,0.372,4.356,1.116c1.175,0.744,2.027,1.764,2.556,3.06
c0.527,1.296,0.743,2.809,0.648,4.536c-0.098,1.729-0.529,3.576-1.297,5.544c-0.863,2.257-1.92,4.261-3.168,6.013 s-2.628,3.252-4.14,4.5s-3.121,2.195-4.824,2.844c-1.704,0.647-3.468,0.972-5.292,0.972c-1.776,0-3.24-0.372-4.392-1.116 c-1.152-0.743-1.992-1.764-2.521-3.06c-0.527-1.296-0.73-2.819-0.611-4.572c0.12-1.752,0.563-3.611,1.332-5.58 c1.823-4.56,4.235-8.075,7.235-10.548C183.407,77.54,186.779,76.304,190.523,76.304z M188.724,90.668 c0.576-1.483,1.044-2.895,1.404-4.234c0.359-1.339,0.587-2.523,0.684-3.552c0.096-1.028,0.047-1.854-0.144-2.477 c-0.192-0.622-0.576-0.934-1.152-0.934s-1.224,0.312-1.944,0.934c-0.72,0.622-1.452,1.448-2.195,2.477 c-0.745,1.028-1.477,2.213-2.196,3.552c-0.72,1.34-1.368,2.751-1.944,4.234c-0.576,1.436-1.057,2.811-1.439,4.126 c-0.385,1.316-0.612,2.477-0.685,3.481c-0.072,1.004,0.012,1.806,0.252,2.403c0.24,0.599,0.648,0.897,1.225,0.897 c0.575,0,1.211-0.299,1.907-0.897c0.695-0.598,1.404-1.399,2.124-2.403c0.721-1.005,1.44-2.165,2.16-3.481 C187.5,93.479,188.147,92.104,188.724,90.668z"/>
</g>
</svg>
</a>
</div>
<div id="menucontainer">
<a class="menu-toggle"><span class="menu-icon"></span>Menu</a>
<ul class="main-nav">
<div class="left">
<li><a href="/">Gear Guide</a></li>
<li><a href="/">Interviews</a></li>
<li><a href="/">Photo Essays</a></li>
<li><a href="/">Reviews</a></li>
<li><a href="/">Editorials</a></li>
<li><a href="/">Sponsors</a></li>
</div>
<div class="right">
<li><a href="/">About</a></li>
<li><a href="/">Newsletter</a></li>
<li><a href="/">RSS</a></li>
<li><a href="/">Twitter</a></li>
<li class="search">
<form method="get" id="search_form" action="http://toolsandtoys.net/">
<input type="input" value="Search..." onblur="if (this.value == ''){this.value = 'Search...';}" onfocus="if (this.value == 'Search...') {this.value = '';}">
</form>
</li>
</div>
</ul>
</div>
</nav>
</div>
<div class="feature">
<div class="contained">
<article>
<h3 class="lined">App Review</h3>
<h1>The Only Camera App You'll Ever Need</h1>
<h2 class="excerpt">Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</h2>
</article>
</div>
</div>
</header>
<main class="main">
<p class="intro">Donec id elit non mi porta gravida at eget metus. Donec ullamcorper nulla non metus auctor fringilla. Donec sed odio dui. Nullam quis risus eget urna mollis ornare vel eu leo. Donec id elit non mi porta gravida at eget metus.</p>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Nullam quis risus eget urna mollis ornare vel eu leo. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec sed odio dui.</p>
<p>Nullam id dolor id nibh ultricies vehicula ut id elit. Sed posuere consectetur est at lobortis. Cras mattis consectetur purus sit amet fermentum. Donec ullamcorper nulla non metus auctor fringilla. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</p>
<p>Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p>
<p class="intro">Original Design by <a href="http://www.toolsandtoys.net" target="_blank">Tools & Toys</a>.</p>
</main>
//Variables are located in my personal template file located here: https://dl.dropbox.com/s/w9ywuzlvqvv7kln/codepen-template.scss
//Breakpoints
$medium: 768px;
$large: 990px;
$serif: Georgia, "Times New Roman", Times, serif;
$sans: Gill Sans, Helvetica, Arial, sans-serif;
body{
font: 1em/1.5 $serif;
}
h1, h2, h3, h4, h5{
font-family: $sans;
font-weight: 600;
}
.contained{
width: 95%;
margin: 0 auto;
@media (min-width: $medium){
max-width: 60rem;
position: relative;
}
}
header{
background: url('https://unsplash.it/1920/1080?image=816') no-repeat;
background-size: cover;
background-position: center;
padding: 2em 0.5em;
position: relative;
}
.overlay{
background: rgba(0,0,0,0.4);
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
transition: background 1s;
}
//Set Z-Index above overlay
.logo,
.main-nav,
.menu-toggle,
.feature{
z-index: 2;
position: relative;
}
.top-nav{
@include row(12);
}
.logo{
@include column(4);
@media (min-width: $large){
position: absolute;
width: 100%;
}
a{
display: block;
width: 100px;
transition: opacity 300ms;
@media (min-width: $medium){
width: 200px;
margin: 2rem 0 0;
}
@media (min-width: $large){
margin: 0.5rem auto;
}
&:hover,
&:focus,
&:active{
opacity: 0.75;
}
}
}
.main-nav{
font: 12px $sans;
padding: 0;
margin: 0;
list-style: none;
width: 100%;
position: absolute;
left: -100%;
top: 120px;
background: rgba(45,45,45,.99);
transition: left 300ms;
z-index: 10;
&.visible{
left: 0;
}
@media (min-width: $medium){
@include column(8);
position: relative;
top: 0;
left: 0;
background: none;
}
@media (min-width: $large){
@include column(12);
}
.left{
width: auto;
@media (min-width: $large){
@include column(4);
li{
border-right: 1px solid white;
border-left: 0;
}
}
}
.right{
width: auto;
@media (min-width: $large){
@include column(4);
@include push(4);
}
}
li{
box-sizing: border-box;
border-bottom: 1px solid #444;
width: 100%;
@media (min-width: $medium){
width: 33.3333%;
border-color: white;
border-left: 1px solid white;
float: left;
}
@media (min-width: $large){
width: 50%;
}
&.search{
width: 100%;
@media (min-width: $medium){
width: 66.6666%;
}
@media (min-width: $large){
width: 100%;
}
}
}
a{
color: white;
text-decoration: none;
padding: .875rem 1rem;
display: block;
transition: 300ms;
text-transform: uppercase;
white-space: no-wrap;
}
a:hover,
a:focus,
a:active{
background: white;
color: black;
}
}
//Search Form
#search_form input{
padding:.875rem 1rem;
background: none;
border: none;
outline: none;
color: white;
text-transform: uppercase;
}
//Menu Toggle
.menu-toggle{
color: white;
text-decoration: none;
display: block;
margin: 25px 0;
width: 100px;
float: right;
text-align: center;
cursor: pointer;
@media (min-width: $medium){
display: none;
}
.menu-icon{
width: 25px;
display: inline-block;
}
.menu-icon:before{
font: normal normal normal 14px/1 'Material-Design-Iconic-Font';
content: '\f197';
}
.menu-icon.triggered:before{
content: '\f136';
}
}
//Feature Headeline
.feature{
padding-top: 8em;
color: white;
article{
width: 100%;
@media (min-width: $medium){
width: 66%;
}
}
h1{
font-size: 3em;
line-height: 1.125;
margin-bottom: .166666667em;
margin-top: .3333333em;
}
.excerpt{
font-family: $serif;
font-size: 1.25em;
line-height: 1.25;
font-weight: normal;
}
h3{
font-size: 0.85em;
text-transform: uppercase;
}
.lined:before,
.lined:after{
content: "";
display: inline-block;
height: 1px;
background: white;
width: 1em;
vertical-align: middle;
}
.lined:before{
margin-right: 5px;
}
.lined:after{
margin-left: 5px;
}
}
//Main Body
main.main{
color: #555;
width: 80%;
max-width: 42rem;
margin: 0 auto;
padding: 2em 0;
.intro{
font-size: 1.5em;
line-height: 1.325;
}
}
$( document ).ready(function() {
//open menu
$('.menu-toggle').click(function() {
$('.menu-icon').toggleClass('triggered');
$('.main-nav').toggleClass('visible');
});
//close menu if click outside of menu
$(document).on('click', function(event) {
if (!$(event.target).closest('#menucontainer').length) {
$('.main-nav').removeClass('visible');
}
});
});
Also see: Tab Triggers