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.
<center><h1> Hier sehen Sie unseren Prototype <br> <span style="color: rgb(255, 0, 0);">•</span> J a m e s <span style="color: rgb(255, 0, 0);">•</span></center> </h1>
<style>
.chat{
position: absolute;
min-width: 140px;
border-radius: 90px;
border: 1px solid #ccd4dd;
bottom: -155px;
right: -5px;
overflow: hidden;
padding: 30px 30px;
border-bottom-left-radius: 8px;
font-size: 20px;
display: flex;
justify-content: center;
align-items: center;
color: #3b83ad;
box-shadow: 0 0 7px #eee;
}
p{
margin: 0;
}
}
</style>
<div class="chat">
<p class="text-message">Möchtest du mich reden hören<br> Klicke unten auf speak vorher bitte stimme auswählen<br> danach könnt ihr auch text eingeben<br> und ich speche dir den text</p>
</div>
</div>
</div>
<style>
.robot {
box-sizing: border-box;
position: relative;
width: 160px;
height: 180px;
bottom: 0;
left: calc(50% - 80px);
margin:20px;
cursor:pointer;
}
.head {
position: absolute;
width: 160px;
height: 100px;
background-color: #ccc;
border-radius: 6px;
overflow: hidden;
background: linear-gradient(to right, #ccc 0%, #e6e6e6 40%, #e6e6e6 60%, #ccc 100%);
transform-origin: 50% 100%;
-webkit-animation: bob 8000ms ease-in-out alternate infinite -1000ms;
animation: bob 8000ms ease-in-out alternate infinite -1000ms;
}
.eyes {
position: absolute;
top: calc(25% - 10px);
right: 30px;
left: 30px;
height: 20px;
-webkit-animation: blink 10000ms linear forwards infinite;
animation: blink 10000ms linear forwards infinite;
}
.eyeball {
position: absolute;
width: 12px;
height: 20px;
border-radius: 50% 50% 50% 50%/60% 60% 40% 40%;
background-color: black;
}
.eyeball_left {
left: 0;
transition: transform 100ms ease-in-out;
}
.eyeball_right {
right: 0;
transition: transform 100ms ease-in-out;
}
.mouth {
position: absolute;
bottom: 5px;
left: 5px;
width: 150px;
height: 20px;
background-color: black;
overflow: hidden;
border-radius: 5px;
transition: height 100ms cubic-bezier(0.455, 0.03, 0.515, 0.955);
}
.mouth-container {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.robot_speaking .mouth {
height: 40px;
}
.robot_speaking .mouth-container {
-webkit-animation: speakingAnim 0.3s infinite;
animation: speakingAnim 0.3s infinite;
}
.mouth-container-line {
position: absolute;
top: 50%;
height: 2px;
background-color: limegreen;
width: 100%;
margin-top: -1px;
}
.torso {
position: absolute;
bottom: 0;
left: calc(50% - 40px);
width: 80px;
height: 60px;
border-radius: 6px 6px 0 0;
background: linear-gradient(to right, #ccc 0%, #e6e6e6 40%, #e6e6e6 60%, #ccc 100%);
}
.neck {
position: absolute;
bottom: 45px;
left: calc(50% - 15px);
width: 30px;
height: 50px;
border-radius: 15px;
background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2) 7%, #646464 10%), linear-gradient(to right, #ccc 0%, #e6e6e6 40%, #e6e6e6 60%, #ccc 100%);
}
.arms {
position: absolute;
bottom: 0;
left: 30px;
right: 30px;
height: 50px;
}
.arm {
position: absolute;
top: 0;
width: 20px;
height: 50px;
border-radius: 10px 10px 0 0;
background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2) 7%, #646464 10%), linear-gradient(to right, #ccc 0%, #e6e6e6 40%, #e6e6e6 60%, #ccc 100%);
}
.arm_left {
left: 0;
}
.arm_right {
right: 0;
}
@-webkit-keyframes lowAnim {
0% {
filter: url("#low-0");
}
25% {
filter: url("#low-1");
}
50% {
filter: url("#low-2");
}
75% {
filter: url("#low-3");
}
100% {
filter: url("#low-4");
}
}
@keyframes lowAnim {
0% {
filter: url("#low-0");
}
25% {
filter: url("#low-1");
}
50% {
filter: url("#low-2");
}
75% {
filter: url("#low-3");
}
100% {
filter: url("#low-4");
}
}
@-webkit-keyframes listeningAnim {
0% {
filter: url("#listening-0");
}
25% {
filter: url("#listening-1");
}
50% {
filter: url("#listening-2");
}
75% {
filter: url("#listening-3");
}
100% {
filter: url("#listening-4");
}
}
@keyframes listeningAnim {
0% {
filter: url("#listening-0");
}
25% {
filter: url("#listening-1");
}
50% {
filter: url("#listening-2");
}
75% {
filter: url("#listening-3");
}
100% {
filter: url("#listening-4");
}
}
@-webkit-keyframes speakingAnim {
0% {
filter: url("#speaking-0");
}
25% {
filter: url("#speaking-1");
}
50% {
filter: url("#speaking-2");
}
75% {
filter: url("#speaking-3");
}
100% {
filter: url("#speaking-4");
}
}
@keyframes speakingAnim {
0% {
filter: url("#speaking-0");
}
25% {
filter: url("#speaking-1");
}
50% {
filter: url("#speaking-2");
}
75% {
filter: url("#speaking-3");
}
100% {
filter: url("#speaking-4");
}
}
@-webkit-keyframes bob {
0% {
transform: rotate(-3deg);
}
40% {
transform: rotate(-3deg);
-webkit-animation-timing-function: cubic-bezier(1, 0, 0, 1);
animation-timing-function: cubic-bezier(1, 0, 0, 1);
}
60% {
transform: rotate(3deg);
}
100% {
transform: rotate(3deg);
}
}
@keyframes bob {
0% {
transform: rotate(-3deg);
}
40% {
transform: rotate(-3deg);
-webkit-animation-timing-function: cubic-bezier(1, 0, 0, 1);
animation-timing-function: cubic-bezier(1, 0, 0, 1);
}
60% {
transform: rotate(3deg);
}
100% {
transform: rotate(3deg);
}
}
@-webkit-keyframes blink {
50% {
transform: scale(1, 1);
}
51% {
transform: scale(1, 0.1);
}
52% {
transform: scale(1, 1);
}
}
@keyframes blink {
50% {
transform: scale(1, 1);
}
51% {
transform: scale(1, 0.1);
}
52% {
transform: scale(1, 1);
}
}
</style>
<div class="robot" title="Ich möchte Dir etwas sagen, ich bin ein Prototyp und bin noch in der Test phase ein Test Projekt!">
<div class="neck"></div>
<div class="arms">
<div class="arm arm_left"></div>
<div class="arm arm_right"></div>
</div>
<div class="torso"></div>
<div class="head">
<div class="eyes">
<div class="eyeball eyeball_left"></div>
<div class="eyeball eyeball_right"></div>
</div>
<div class="mouth">
<div class="mouth-container">
<div class="mouth-container-line"></div>
</div>
</div>
</div>
</div>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" style="display:none">
<defs>
<!-- Low -->
<filter id="low-0">
<feTurbulence id="turbulence"
baseFrequency="0.02"
numOctaves="3"
result="noise"
seed="0"></feTurbulence>
<feDisplacementMap id="displacement"
in="SourceGraphic"
in2="noise"
scale="1" ></feDisplacementMap>
</filter>
<filter id="low-1">
<feTurbulence id="turbulence"
baseFrequency="0.02"
numOctaves="3"
result="noise"
seed="30"></feTurbulence>
<feDisplacementMap in="SourceGraphic"
in2="noise"
scale="1.5" ></feDisplacementMap>
</filter>
<filter id="low-2">
<feTurbulence id="turbulence"
baseFrequency="0.02"
numOctaves="3"
result="noise"
seed="2"></feTurbulence>
<feDisplacementMap in="SourceGraphic"
in2="noise"
scale="1" ></feDisplacementMap>
</filter>
<filter id="low-3">
<feTurbulence id="turbulence"
baseFrequency="0.02"
numOctaves="3"
result="noise"
seed="30"></feTurbulence>
<feDisplacementMap in="SourceGraphic"
in2="noise"
scale="1.5" ></feDisplacementMap>
</filter>
<filter id="low-4">
<feTurbulence id="turbulence"
baseFrequency="0.1"
numOctaves="3"
result="noise"
seed="4"></feTurbulence>
<feDisplacementMap in="SourceGraphic"
in2="noise"
scale="0.5" ></feDisplacementMap>
</filter>
<!-- Listening -->
<filter id="listening-0">
<feTurbulence id="turbulence"
baseFrequency="0.02"
numOctaves="3"
result="noise"
seed="0"></feTurbulence>
<feDisplacementMap id="displacement"
in="SourceGraphic"
in2="noise"
scale="2" ></feDisplacementMap>
</filter>
<filter id="listening-1">
<feTurbulence id="turbulence"
baseFrequency="0.02"
numOctaves="3"
result="noise"
seed="30"></feTurbulence>
<feDisplacementMap in="SourceGraphic"
in2="noise"
scale="3" ></feDisplacementMap>
</filter>
<filter id="listening-2">
<feTurbulence id="turbulence"
baseFrequency="0.02"
numOctaves="3"
result="noise"
seed="2"></feTurbulence>
<feDisplacementMap in="SourceGraphic"
in2="noise"
scale="2" ></feDisplacementMap>
</filter>
<filter id="listening-3">
<feTurbulence id="turbulence"
baseFrequency="0.02"
numOctaves="3"
result="noise"
seed="30"></feTurbulence>
<feDisplacementMap in="SourceGraphic"
in2="noise"
scale="3" ></feDisplacementMap>
</filter>
<filter id="listening-4">
<feTurbulence id="turbulence"
baseFrequency="0.1"
numOctaves="3"
result="noise"
seed="4"></feTurbulence>
<feDisplacementMap in="SourceGraphic"
in2="noise"
scale="1" ></feDisplacementMap>
</filter>
<!-- Speaking -->
<filter id="speaking-0">
<feTurbulence id="turbulence"
baseFrequency="0.02"
numOctaves="3"
result="noise"
seed="0"></feTurbulence>
<feDisplacementMap id="displacement"
in="SourceGraphic"
in2="noise"
scale="12" ></feDisplacementMap>
</filter>
<filter id="speaking-1">
<feTurbulence id="turbulence"
baseFrequency="0.02"
numOctaves="3"
result="noise"
seed="30"></feTurbulence>
<feDisplacementMap in="SourceGraphic"
in2="noise"
scale="13" ></feDisplacementMap>
</filter>
<filter id="speaking-2">
<feTurbulence id="turbulence"
baseFrequency="0.02"
numOctaves="3"
result="noise"
seed="2"></feTurbulence>
<feDisplacementMap in="SourceGraphic"
in2="noise"
scale="12" ></feDisplacementMap>
</filter>
<filter id="speaking-3">
<feTurbulence id="turbulence"
baseFrequency="0.02"
numOctaves="3"
result="noise"
seed="30"></feTurbulence>
<feDisplacementMap in="SourceGraphic"
in2="noise"
scale="13" ></feDisplacementMap>
</filter>
<filter id="speaking-4">
<feTurbulence id="turbulence"
baseFrequency="0.1"
numOctaves="3"
result="noise"
seed="4"></feTurbulence>
<feDisplacementMap in="SourceGraphic"
in2="noise"
scale="11" ></feDisplacementMap>
</filter>
</defs>
</svg>
<form id="demo" class="widget-wrap">
<div id="vol"></div>
<h1>James TEXT-TO-SPEECH</h1>
<!-- (A) VOICE PICKER -->
<label>Wählen Sie eine Stimme</label>
<select id="demo-voice" disabled></select>
<!-- (B) VOLUME + PITCH + RATE -->
<label>Volume</label>
<input type="range" id="demo-vol" min="0" max="1" step="0.1" value="1" disabled>
<label>Pitch</label>
<input type="range" id="demo-pitch" min="0" max="2" step="0.1" value="1" disabled>
<label>Rate</label>
<input type="range" id="demo-rate" min="0.1" max="10" step="0.1" value="1" disabled>
<!-- (C) SAY SOMETHING -->
<label>Message</label>
<input type="text" id="demo-msg" value="Darf ich mich vorstellen Ich bin James ihr neuer Forum-Roboter.
Herzlich willkommen im Black - Angel´s - Club!
Black - Angel´s - Club hat am 16.Oktober 2022 seine Pforten geöffnet.
Wenn Du also gern schreibst, Dich und Deine Interessen im Forum einbringst, bist Du hier genau richtig!
Wir haben einige geschützte Bereiche wie z.B. • Private Foto-Galerie für Mitglieder.
Bei uns kannst Du Dich ohne Verpflichtung und kostenlos anmelden.
Willkommen ist jeder, der sich selbst gern in netter Weise einbringt und sich nicht nur die Zeit mit Lesen vertreiben will.
Stell Dich bitte nach dem Registrieren kurz im Mitgliederbereich vor. Und ihr Lieben Gäste ihr Dürft Euch gerne ins Gästebuch eintragen.
Danke!
Viel Spaß Euere
James!" disabled />
<!-- (D) GO! -->
<label>Go!</label>
<input type="submit" id="demo-go" disabled value="Speak"/>
</form>
<script id="rendered-js">
window.onload = () => {
// (A) TTS SUPPORTED
if ("speechSynthesis" in window) {
// (B) GET HTML ELEMENTS
let demo = document.getElementById("demo"),
vlist = document.getElementById("demo-voice"),
vvol = document.getElementById("demo-vol"),
vpitch = document.getElementById("demo-pitch"),
vrate = document.getElementById("demo-rate"),
vmsg = document.getElementById("demo-msg"),
vgo = document.getElementById("demo-go");
// (C) POPULATE AVAILABLE VOICES
var voices = () => {
speechSynthesis.getVoices().forEach((v, i) => {
let opt = document.createElement("option");
opt.value = i;
opt.innerHTML = v.name;
vlist.appendChild(opt);
});
};
voices();
speechSynthesis.onvoiceschanged = voices;
// (D) SPEAK
var speak = () => {
let msg = new SpeechSynthesisUtterance();
msg.voice = speechSynthesis.getVoices()[vlist.value];
msg.text = vmsg.value;
speechSynthesis.speak(msg);
return false;
};
// (E) ENABLE FORM
demo.onsubmit = speak;
vlist.disabled = false;
vvol.disabled = false;
vpitch.disabled = false;
vrate.disabled = false;
vmsg.disabled = false;
vgo.disabled = false;
}
// (X) TTS NOT SUPPORTED
else {
alert("Text-to-speech is not supported on your browser!");
}
};
//# sourceURL=pen.js
</script>
Also see: Tab Triggers