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.
<link href="https://fonts.googleapis.com/css?family=VT323" rel="stylesheet">
<div id="pomodoroClock">
<h1>Pomodoro Clock</h1>
<div id = "container">
<div id = "workTimer">
<span id = "labelWorkTimer">
Work Timer
</span></br>
<span id = "workMinutes">
25
</span>
</div>
<div id = "breakTimer">
<span id = "labelBreakTimer"> Break </span></br>
<span id = "breakMinutes">
5
</span>
</div>
<div id = "timer">
<div id = "time">
<span id = "minutes">25</span>
<span id = "colon">:</span>
<span id = "seconds">00</span>
</div>
</div>
<div id = "status">
WORK
</div>
<div id = "buttons">
<span id = "workId"><button id = "work">Work</button></span>
<span id = "workId"><button id = "workMinus">Work -</button> </span>
<span id = "workId"><button id = "workPlus">Work +</button> </span>
<!--<span id = "breakId"><button id = "break">Break</button></span>-->
<span id = "breakId"><button id = "breakMinus">Break - </button>
<span id = "breakId"><button id = "breakPlus">Break + </button> </span>
</span>
<button id="pause">Pause</button>
<button id = "resume">Resume</button>
<button id="reset">Reset</button>
</div>
</div>
</div>
h1{
text-align:center;
font-family: 'VT323', monospace;
font-size:3em;
}
#container{
border: 1px solid #333;
border-radius: 20px;
width: 800px;
margin: 20px auto;
padding: 20px;
text-align: center;
background: #333;
}
#workTimer{
background-color:#ebebe0;
float:left;
color:#f00;
font-size: 25px;
margin: 100px auto;
/*padding: 10px 10px 10px 10px;*/
border: 5px solid red;
border-radius: 50%;
width: 110px;
height: 110px;
overflow: hidden;
positon: relative;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor:default;
}
#labelWorkTimer{
position:relative;
top:10px;
}
#workMinutes{
position:relative;
top:10px;
}
#breakTimer{
float:right;
color:#f00;
background-color:#ebebe0;
font-size: 25px;
margin: 100px auto;
/*padding: 10px 10px 10px 10px;*/
border: 5px solid red;
border-radius: 50%;
width: 110px;
height: 110px;
overflow: hidden;
positon: relative;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor:default;
}
#labelBreakTimer{
position:relative;
top:10px;
}
#breakMinutes{
position:relative;
top:10px;
}
#timer{
background-color:#ebebe0;
color: #f00;
font-size: 50px;
margin: 10px auto;
border: 5px solid red;
border-radius: 50%;
width: 200px;
height: 200px;
overflow: hidden;
positon: relative;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor:default;
}
#time{
margin-top: 70px;
z-index: 1;
position: relative;
}
#filler{
background: #ddffcc;
height: 0px;
width: 200px;
position:absolute;
bottom: 0;
}
#buttons button {
background: #4da6ff;
border: none;
color: #fff;
cursor: pointer;
padding: 5px;
width: 90px;
margin: 10px auto;
font-size: 14px;
height: 50px;
border-radius: 50px;
}
#breakTimer{
color:#f00;
}
#status{
color:#f00;
font-size:1.5em;
}
#buttons button#work{
background-color:#0039e6;
}
#buttons button#workPlus{
background-color:#b380ff;
}
#buttons button#workMinus{
background-color:#b380ff;
}
#buttons button#break{
background-color: #0c0;
}
#buttons button#pause{
background-color: #cc3300;
}
#buttons button#resume{
background-color:#33ff33;
}
#buttons button#reset{
background-color: #7300e6;
}
$(document).ready(function() {
$('#resume').hide();/*the resume button is behind the pause button it appears when you hit pause*/
var breakCount = 5;//initializes the breakCount to 5 minutes
var workCount = 25;//initializes the workCount to 25 minutes
var seconds = 60; //sixty seconds in an interval or minute
var workCheck = true;
var clock = '';
var count = '25'
var beep = new Audio('http://www.briankiddmedia.com/sounds/beep.wav');
var breakTime = new Audio('http://www.briankiddmedia.com/sounds/break.wav');
var breakOver = new Audio('http://www.briankiddmedia.com/sounds/breakOver.wav');
function timer() {//this function creates the actual count down
// $('#time').html(display);
if (seconds === 60) {
if (count > 0) {
count--;
$('#minutes').html(count);
}
if (count === 0) {
$('#minutes').html('00');
}
}
seconds--;
if (seconds < 10) {
$('#seconds').html("0" + seconds);
} else {
$('#seconds').html(seconds);
}
if (seconds === 0 && count > 0) {/*This conditional resets the seconds */
seconds = 60;
}
if (seconds === 0) {//this is where it the function transitions to break time
if (workCheck === true) {//this is like the trigger to tell the program that now it is break time
workCheck = false;
breakTime.play();
count = breakCount;
seconds = 60;
$('#status').html('BREAK!');
$('#workMinus, #workPlus').attr("disabled", "disabled");
$("breakMinus, #breakPlus").removeAttr("disabled");
} else {
workCheck = true;
breakOver.play();
count = workCount;
seconds = 60;
$('#status').html('WORK');
}
}
}
//the following is the break display for the break timer
$('#breakMinus').click(function(){
breakCount--;
if (breakCount < 1){
breakCount= 1;
}
$('#breakMinutes').html(breakCount);
});
$('#breakPlus').click(function(){
breakCount++;
$('#breakMinutes').html(breakCount);
});
//the following is the work timer display adjustment
$('#workMinus').click(function() {
workCount--;
count--;
if (workCount < 1){
workCount= 1;
count=1;
}
$('#workMinutes, #minutes').html(workCount);/*This displays the new work count */
});
$('#workPlus').click(function() {
workCount++;
count++;
$('#workMinutes, #minutes').html(workCount);
});
$('#work').click(function(){
beep.play();
$('#work').css("background-color", "#ccccff");
$('#workMinus, #workPlus').css("background-color", "#ccccff");
$('#workMinus, #workPlus').attr("disabled", "disabled");
clock = setInterval(timer, 1000);/*this is what makes the clock count in seconds as it counts down using the timer function*/
$(this).attr("disabled", "disabled");/*This was necessary so you cannot press Work again when the button is active. if the user was able to click work button again it would double the interval time and the seconds would move twice as fast */
$('#pause').show();
$('#resume').hide();
});
$('#pause').click(function(){
// $('#pause').show().html("Resume");
$('#resume').show();
$('#pause').hide();
clearInterval(clock);
});
$('#resume').click(function(){
beep.play();
$('#work').attr("disabled", "disabled");
$('#work').css("background-color", "#ccccff");
clock = setInterval(timer, 1000);
$('#pause').show();
$('#resume').hide();
});
$('#reset').click(function () {
$('#work').css("background-color", "#0039e6");
$('#workMinus, #workPlus').css("background-color", "#b380ff");
$('#pause').show();
$('#resume').hide();
$('#work').show();
$("#work").removeAttr("disabled");
clearInterval(clock);
$("#workMinus, #workPlus").removeAttr("disabled");
workCheck = true;
breakCount = 5;
workCount = 25;
seconds = 60;
count = 25;
clock = ' ';
$('#workMinutes').html('25');
$('#minutes').html('25');
$('#breakMinutes').html('5');
$('#seconds').html('00');
$('#status').html('WORK');
});
});
Also see: Tab Triggers