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 URL's added here will be added as <link>
s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
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.
If the stylesheet 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 CSS 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.
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.
<!-- 右邊工具列 -->
<main>
<nav>
<button class="material-icons">list</button>
<button class="material-icons">insert_chart</button>
<button class="material-icons">library_music</button>
<p>POMODORO</p>
</nav>
<div id="input">
<input id="new" type="text" placeholder="add a new mission…" />
<i class="material-icons add">add</i>
<!-- <i class="material-icons close">close</i> -->
</div>
<!-- 左邊工具列 -->
<div id="timer" class="todolist">
<input type="checkbox" id="todo">
<label for="todo">
<span class="icons">
<i class="material-icons unchecked">radio_button_unchecked</i>
<i class="material-icons checked">radio_button_checked</i>
</span>
<div>
<span>the First thing to do today</span>
<div class="subTitle"></div>
</div>
</label>
<time datetime="2019-07-10 20:00">
<span id="mm">25</span>
<span id="split" class="blink">:</span>
<span id="ss">00</span>
</time>
</div>
<div id="clock">
<div>
<button id="play_arrow" class="material-icons">play_arrow</button>
<button id="stop" class="material-icons">stop</button>
</div>
</div>
<ul id="todoList">
<li class="todolist item">
<input type="checkbox" id="todo1">
<label for="todo1">
<span class="icons">
<i class="material-icons unchecked">radio_button_unchecked</i>
<i class="material-icons checked">radio_button_checked</i>
</span>
<div>the second thing to do today</div>
</label>
<i class="material-icons">play_circle_outline</i>
</li>
<li class="todolist item">
<input type="checkbox" id="todo2">
<label for="todo2">
<span class="icons">
<i class="material-icons unchecked">radio_button_unchecked</i>
<i class="material-icons checked">radio_button_checked</i>
</span>
<div>the third thing to do today</div>
</label>
<i class="material-icons">play_circle_outline</i>
</li>
<li class="todolist item">
<input type="checkbox" id="todo3">
<label for="todo3">
<span class="icons">
<i class="material-icons unchecked">radio_button_unchecked</i>
<i class="material-icons checked">radio_button_checked</i>
</span>
<div>the forth thing to do today</div>
</label>
<i class="material-icons">play_circle_outline</i>
</li>
<div class="more">MORE</div>
</ul>
</main>
$white: #fff
$pink: #ff4384
$blue: #003164
@media (min-width: 426px) and (max-width: 1280px)
font-size: 14px
@media (max-width: 425px)
font-size: 12px
*
box-sizing: border-box
padding: 0
margin: 0
text-transform: uppercase
font-family: 'Roboto', sans-serif
::placeholder
color: $pink
@keyframes blink
from
opacity: 1
50%
opacity: 0
to
opacity: 1
.blink
animation: blink 1s infinite
html, body
display: block
width: 100%
height: 100%
main
position: relative
display: block
width: 100%
height: 100%
background: linear-gradient(to right, #FFEDF7 64.84375%, $blue 64.84375%)
.material-icons
cursor: pointer
button
background: transparent
outline: none
border-width: 0
cursor: pointer
nav
position: absolute
right: 6%
top: 6%
display: flex
justify-content: space-between
align-items: center
width: 2.25em
height: calc(100% - 96px)
-webkit-writing-mode: vertical-rl
-ms-writing-mode: tb-rl
writing-mode: vertical-rl
button
color: $white
font-weight: 400
line-height: 1.5
flex: 0 0 auto
width: 2.25em
height: 2.25em
color: $white
vertical-align: middle
text-align: left
overflow: hidden
p
font-size: 1.5em
color: $white
font-weight: 700
line-height: 1.5
flex: 1 1 auto
text-align: right
#clock
position: absolute
top: 50%
-webkit-transform: translateY(-50%)
transform: translateY(-50%)
-webkit-transform: translateX(-50%) translateY(-50%)
transform: translateX(-50%) translateY(-50%)
left: 64.84375%
display: block
width: 42.1875%
max-width: 540px
min-width: 200px
font-size: 0
border: 4px solid $pink
border-radius: 50%
z-index: 1
> div
position: absolute
top: 50%
left: 50%
-webkit-transform: translate(-50%, -50%)
transform: translate(-50%, -50%)
#play_arrow
display: block
width: 6rem
height: 6rem
font-size: 6rem
color: $pink
background-color: $white
border-radius: 50%
#stop
position: absolute
bottom: 0
right: -1.5rem
display: block
width: 1.5rem
height: 1.5rem
font-size: 1.5rem
color: $white
&::before, &::after
display: block
content: '\200B'
border-radius: 50%
&::before
width: 96%
height: 96%
position: absolute
top: 50%
left: 50%
margin-top: -48%
margin-left: -48%
background-color: $pink
&::after
padding-bottom: 100%
@media (max-width: 425px)
#clock
top: 62.5%
.todolist
input
display: none
~ label
.unchecked
display: inline-block
.checked
display: none
&:checked ~ label
.unchecked
display: none
.checked
display: inline-block
label
display: inline-flex
text-transform: uppercase
.subTitle
display: block
width: 0.75em
height: 0.75em
border: 1px solid $pink
border-radius: 50%
margin-top: 0.5em
#timer
position: absolute
top: 50%
-webkit-transform: translateY(-50%)
transform: translateY(-50%)
left: 6.640625%
color: $blue
z-index: 2
label
font-size: 1.5em
color: $blue
font-weight: 700
line-height: 1.16667
text-shadow: 1px 1px 2px #FFEDF7
.icons
display: inline-block
-webkit-user-select: none
-moz-user-select: none
-ms-user-select: none
user-select: none
font-size: 0
.material-icons
font-size: 3rem
margin-right: 16px
time
display: block
font-size: 0
text-shadow: 1px 1px 2px #FFEDF7
span
font-size: 11rem
color: $pink
font-weight: 700
line-height: 1
@media (max-width: 425px)
#timer
top: 37.5%
#input
width: 41.40625%
position: relative
display: inline-block
padding: 3rem 0 3rem 6.640625%
#new
font-size: 1rem
color: $pink
font-weight: 700
line-height: 1.5
width: 100%
height: 7%
border-width: 0
padding: 1.1875em 2.5rem 1.125em 1em
outline: none
.material-icons
position: absolute
top: 3rem
right: 0
display: inline-block
width: 1.5rem
height: 1.5rem
color: $pink
font-size: 1.5rem
overflow: hidden
margin: 1rem 1rem 1rem 0
#todoList
display: block
width: 34.765625%
position: absolute
bottom: 6%
left: 6.640625%
li
font-size: 1rem
color: $blue
font-weight: 700
line-height: 1.5
display: inline-flex
width: 100%
justify-content: space-between
align-items: center
height: 2rem
line-height: 2rem
overflow: hidden
white-space: nowrap
text-overflow: ellipsis
border-bottom: 1px solid $blue
label
justify-content: flex-start
align-items: center
span
display: inline-flex
.material-icons
margin-right: 0.25rem
div
overflow: hidden
text-overflow: ellipsis
&.item label
width: calc(100% - 24px)
.material-icons
flex: 0 0 24px
width: 24px
height: 24px
.more
font-size: 1rem
color: $pink
font-weight: 700
line-height: 1.1875
display: block
margin-top: 0.5625em
color: #FF4384
float: right
cursor: pointer
Also see: Tab Triggers