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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
-test = 'A Table'
-filter = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAYCAYAAAARfGZ1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAvhJREFUeNqklU9I1EEUx/ePuxaVlEZRCdWlIOvQJSGhoH+HIokOHaKMMMqICMq6dNk1Okh2yDCL0BKtQ4cOhRUkBFZs3iI7FBkGLkQIlUgsurva57vMb5udfqtQDz68fTPvvXm/mTezwUQiEfAkGAwGpqen87+FkRJogOWQgSf4vQlYojg73gsqKtZCtajr1tQ22ArZmeJDPmMbYK1ll01NTZ2FgEUNC+9x4srcRG7lO6jyPjoCL+Al1DJW41NEq9mmn3AQn2p0HG7kt9na8y3wECoC/y7ax9PQlqs8m81vW9VMia3DLTg01w2O5ZNbQT1wAVb5BP2AxzAKC4jZVcRPcie/5+l0OldVKBQaR793gxi7RqUt6KQ1vBQOM97sNEXabO1fB1qJ80anFePhcDiWizJFaEvgWzQabUF/ZarbbIfXfeVsdVJdJWMhnMB4BCusduuHS0oqkANwWb5QOjExobF7JOq0YsLQrq7LVY7RQUX7ffbuJuNZBaEb0Ve8yk3bHWdR3dY27HorbjM+z9EdqrzafGoByJAS6wywY3aXoI+qdc0TMYI96sRK6kswwkVayzuoUpjjMz/far+wbwISt8O4c73Fat0B9Gfm79pz2APoV8auhHI3Hp936pYmjGcYF3XVrYUb+OQHegWZP69P5/d6GGa8Fb5rcfRJp+Bh9TrjXcG+vr6AnAiex+AnWGY5xpiLq5JIJPKnmeke7oXQm9JjtWLadEq/zqMklUp5Mb90kdzksAhaSJi03uslUMeizVZiyRfmX+uHirEv0W6cV/qcyxk4BL3e9YedOhMfX93udTA4OTlZ8HDVmc7wkwozP5to745AY/5tMdLNZ29HL/6fJxcZ9HtbejOZjKq7rb0zb4YO5BRs8snyAdVJQWvQ+2AunOMt6ir2T/SUoCoCxrwB9nYA9da+SHq4UHtpgCHj06SHDzsx23/omGN/5Is6dDYeJNPXDVk+I5CY7T+0QHTiRq6SUJ0SVcvyZbe8hXh6i8b/FmAAat7XYReSgx0AAAAASUVORK5CYII='
-star = 'http://cdn1.iconfinder.com/data/icons/crystalproject/16x16/apps/keditbookmarks.png'
doctype 5
html
head
body
.container
h2 = test
table.rules
thead
tr
th Status
th Rating
th Name
th Company
th.date Date effective
th Classification
th.last Edit
tbody
tr.record
td
.toggle.enabled
td.rating
img src=star
img src=star
img src=star
img.filter src=star
img.filter src=star
td.overflow John Doe
td.overflow title="Sunshine Northwind Systems, Incorporate (Really Long Company Name): Note the elipsis" Sunshine Westwind Systems, Incorporate
td.date 2013/12/13
td Advanced
td.last
a href="#"
img.filter src=filter width="26"
tr.companion
td.output colspan="7"
p Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum pharetra nunc sit amet arcu dignissim, vestibulum pharetra turpis bibendum. Donec nisi felis, elementum ut lectus vitae, sagittis condimentum sem. Praesent at sapien turpis. Maecenas feugiat feugiat est, vel hendrerit elit congue vitae. Fusce quis velit sed urna ultricies molestie quis non neque. Vestibulum ultrices quam et enim fringilla tempus. Cras ornare magna eu pellentesque elementum. Duis vel magna eget lacus imperdiet consequat. Mauris cursus porttitor vulputate. Ut egestas diam vitae massa tincidunt, et tempus dui laoreet. Praesent consequat turpis ac ante pretium, id auctor ante aliquet.
tr.record
td
.toggle.disable
td.rating
img src=star
img src=star
img src=star
img src=star
img src=star
td.overflow Jane Smith
td.overflow Northwind
td.date 2013/12/13
td Advanced
td.last
a href="#"
img.filter src=filter width="26"
tr.companion
td.output colspan="7"
p Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum pharetra nunc sit amet arcu dignissim, vestibulum pharetra turpis bibendum. Donec nisi felis, elementum ut lectus vitae, sagittis condimentum sem. Praesent at sapien turpis. Maecenas feugiat feugiat est, vel hendrerit elit congue vitae. Fusce quis velit sed urna ultricies molestie quis non neque. Vestibulum ultrices quam et enim fringilla tempus. Cras ornare magna eu pellentesque elementum. Duis vel magna eget lacus imperdiet consequat. Mauris cursus porttitor vulputate. Ut egestas diam vitae massa tincidunt, et tempus dui laoreet. Praesent consequat turpis ac ante pretium, id auctor ante aliquet.
tfoot
tr
td colspan="7"
@import compass
$disabled: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAAbCAYAAAAkoDzBAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA/ZJREFUeNrkWUtPU0EUPm2hb6AttMXWluujSBUkhEfkV/AHdOmCDfwcN+7Y4J5AomlETIRg2VmUR40JbXkEbhEoJS0UzzdwL7cYH4mMpniSQ+5tZzrzzXl9ZzAlEgli6WAdZn3M6qPrKXnWMdZnrJ/q+M89k8n00evxkMvlIrPZfC1RVyoVb6FQGMnv7o6cnp4qQDkM0A0NDdcWNATYgNHT1ITXYVj8idPpJD4F+h8EXs1WfwrgPnb1vwK8rr5enDoWr+dni8VCJycnVC6Xid2QDvb3xbNMAVZgBnCSDRmLtbS0kIdD6nzhi8OoqxPqcDioubmZ9hn85uamdEMI4CRxEVg1fPMm2e323zqgxsZGslqtlM1khDdIBS7rdAHkRihUBZqzK6VX05RZy9Dh4SEhv0TbonTn7h19DMZjXmZtTdrepAL3+/0CmCYbGxs0NTFFVpuVfD4v2R12Ojoqini/LJiH8Nja2qot4ADj9V1woY11Bj05RV3dnSK5adLE5SUUDuvvx8fHIuYhmK+qqpSEZ9aAX7UCnJbI4N4zMzPU199LWumEAmAgGNQ3g5ienJgU47VQcfLvXPXepFrcarPpz+l0mhSlTZAI41qtra26dSGz72bJ5XaK8bFY7CzebXYp+5M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achsU2CfAGYz1Br+nPXmBJpQnOUzCI0TI5+PBHDQL8mOEfKl3gOWboLwX4CQHus3iawNmKAIdgJWY5k90rJNqzbcmBV8hrUec+hZ7pDgRnOu0FN82lkeZuvhqHKr7FlrJabNb24MfI1xhMPLNlLJaNOFt0efk6HNWvZKCF6crGzH61o3bBx1oyEfdReh/RL6G6bHfecb+yHtvL6tA39adNqW5zR9+g1SCceoGkGZ+npqtwpLKxAFrY47EO/BZpgcmZTc3Nxoh/4t6Pw6vPITDViZ/+v4yUlXh3ziuvQX2liPSnBff99boDrcFGJNUYHF6+fJqbgzlR6/0CB/ST0Oj7bvcBpM002kavYsachk+pwldVBO3cVQg9eh+tfZcRl6fgKJfJP2n5gO/y7MOXlWfzju31HoRF278nH+Bz//F5of8I/47bfU1IyDFobjVzvWVi+dT4y6levIgF8GF5Td7xWoLf6foMTu4quKfzv18p0k1IKXFoHoVW0RJ1YXtKkOVqfKE1MBbEzWcX0D/RXTDofNCPQu34obcJSTkBlSJNa0tb/Mr1M5ZL9YWWxGWEZ0bwfXcj/o12v3f2H460o/Wfq0jSE5TiEunNbPEpJ1vBwTkUj4ZwIoSbXZcQjHbNDz38C1oD1ynSxYHOB6e1uh0C/f4qHhXhZAg3nl5EYOxJHvT9Vz+j5fk1JJUkZFe2pu3yJc8vO2s8J4lxqlkNkdQovnvSiJ7I48zA9wbv4lbgBgyVIl2uZlyx04+5NV6UlRv1KagehvGJcbT0XMd2/WN0hh4grZrQXFrmHYhd3XvRVm7vjOBUN0PozQiGBoagrKJMKNeywEWGnhXxIj2PM4lqWYWkGuBlHKaYjUWAzoGPM0PxGcwoyoASpb3szK69rUWA5mZm7HEBfscV95+JOl+viFdO7rguNi0CvFmPrT0jJn/SEYUhGSUJzC0O90wF/LEPxG6zAA9KkLZVxtY1kI6JR+QSDfbsf1IG3wowAH3ZWFtW8JY5AAAAAElFTkSuQmCC'
*::selection:not(p)
background: transparent
html, body
background: #EEE
.test
background: #ffc0cb
.container
background: #fff
position: relative
width: 96%
max-width: 960px
min-width: 768px
margin: 50px auto auto
padding: 0 2%
border: 1px solid #CCC
min-height: 500px
.row
float: left
width: 100%
margin: 0 0 25px 0
.copy
float: left
width: 100%
max-width: 65%
p
font: normal normal normal 0.9em / 1.2em BLOKKRegular
color: #333
margin: 0
.metrics
float: right
width: 100%
max-width: 35%
.metric-active, .metric-avail
float: right
min-height: 70px
padding: 10px 15px 5px
margin: 0 0 0 3px
vertical-align: middle
font-family: arial
color: #7685a5
border: 1px solid #333
border-color: #ccc
border-radius: 4px
background: #fcfcfc
span
font-size: 3.5em
font-weight: normal
.outer
position: relative
.inner
position: absolute
top: 50%
.elem
position: relative
top: -50%
table
width: 100%
border-collapse: collapse
font-family: arial
margin: 0 0 25px 0
border-radius: 15px
thead tr th
vertical-align: middle
text-align: left
padding: 10px 0 8px 15px
border: 1px solid #b7b7b7
background: #e9eaec
background: -moz-linear-gradient(top, #e9eaec 1%, #dee2e8 100%)
background: -webkit-gradient(linear, left top, left bottom, color-stop(1%, #e9eaec), color-stop(100%, #dee2e8))
background: -webkit-linear-gradient(top, #e9eaec 1%, #dee2e8 100%)
background: -o-linear-gradient(top, #e9eaec 1%, #dee2e8 100%)
background: -ms-linear-gradient(top, #e9eaec 1%, #dee2e8 100%)
background: linear-gradient(to bottom, #e9eaec 1%, #dee2e8 100%)
color: #9c9c9c
border-color: #b7b7b7
font: normal normal bold 0.8em / 1.5 sans-serif
text-shadow: 0 1px #fff
tbody tr
&:first-child td
border-width: 1px 0 1px 0
&.ui-selected
td, &:hover td
background: #efefef
td
font: normal normal bold 0.8em / 1.5em arial
vertical-align: middle
text-align: center
padding: 10px 8px 8px
border-style: solid
border-width: 0 0 1px 0
border-color: #bbb #ccc #ccc #ccc
background: #fdfdfd
color: #6c6c6c
&:first-child
border-left-width: 1px
&:last-child
border-right-width: 1px
.toggle
width: 62px
height: 27px
margin: auto
&.enabled
background: transparent url($enabled) no-repeat 0 0 scroll
&.disable
background: transparent url($disabled) no-repeat 0 0 scroll
&.output
text-align: left
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAFCAYAAACEhIafAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAABdJREFUGFdjAAJlECEFIoRABCcQMzAAAAWUAFmQZlpWAAAAAElFTkSuQmCC")
background-repeat: repeat-x
margin: 0
padding: 0 7px 0 5px
position: relative
p
padding: 20px
.intent
position: absolute
top: -1px
right: -1px
width: 200px
height: 100px
.options
position: absolute
top: 0
right: 0
padding: 6px
background: #eee
border: 1px solid #ccc
img
margin: 0 3px
&:hover
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAFCAYAAACEhIafAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAABdJREFUGFdjAAJlECEFIoRABCcQMzAAAAWUAFmQZlpWAAAAAElFTkSuQmCC")
background-repeat: repeat-x
//background-color: #f0ffe7
cursor: default
&:nth-child(odd)
background-color: #fafafa
&:hover td
background: #ffffd3
background: -moz-linear-gradient(top, #ffffd3 0%, #ffffaf 100%)
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffd3), color-stop(100%, #ffffaf))
background: -webkit-linear-gradient(top, #ffffd3 0%, #ffffaf 100%)
background: -o-linear-gradient(top, #ffffd3 0%, #ffffaf 100%)
background: -ms-linear-gradient(top, #ffffd3 0%, #ffffaf 100%)
background: linear-gradient(to bottom, #ffffd3 0%, #ffffaf 100%)
border-color: #bbb #aaa #ccc #aaa
border-style: solid dotted
cursor: pointer
tfoot tr td
background: #e9eaec
border: 1px solid #ccc
min-height: 25px
.enable, .disabled
width: 100%
height: 28px
font: normal normal bold 1em / 1.5em arial
color: #eee
border-radius: 4px
box-shadow: inset 1px 0 3px rgba(255, 255, 255, 0.4)
.enable
border-style: solid
border-width: 1px 1px 4px 1px
border-color: #efefef #ddd #0f0
color: #008000
background: #bbb
.disabled
border-style: solid
border-width: 1px 1px 4px 1px
border-color: #efefef #ddd #777
color: #777
background: #bbb
.enable:active, .rating
padding: 0
text-align: center
.enable:active img, .rating img
margin-left: 2px
.overflow
max-width: 120px
white-space: nowrap
overflow: hidden
text-overflow: ellipsis
.date
min-width: 48px
max-width: 70px
white-space: nowrap
overflow: hidden
text-overflow: ellipsis
.filter
-webkit-filter: grayscale(100%)
.companion
display: none
$(function(){
$('.record td').on('click', function(){
$(this).parent('.record').next('.companion').toggle();
})
$('.toggle').on('click', function(event){
event.stopPropagation();
$(this).toggleClass("enabled disable")
})
});
Also see: Tab Triggers