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.
<!-- Pour cette exercice j'ai utilisé la Google font Work Sans : https://fonts.google.com/specimen/Work+Sans -->
<div class="menu">
<ul>
<li><a href="#couleur">→ Couleur</a></li>
<li><a href="#taille">→ Taille</a></li>
<li><a href="#italique">→ Italique</a></li>
<li><a href="#graisses">→ Graisses</a></li>
<li><a href="#interlettrage">→ Interlettrage</a></li>
<li><a href="#espacemots">→ Espace entre les mots</a></li>
<li><a href="#souligne">→ Souligné</a></li>
<li><a href="#capitale">→ Capitale</a></li>
<li><a href="#1capitale">→ 1ère lettre en capitale</a></li>
<li><a href="#interlignage">→ Interlignage</a></li>
<li><a href="#droite">→ Ferré à droite</a></li>
<li><a href="#centre">→ Centré</a></li>
<li><a href="#justifie">→ Justifié</a></li>
<li><a href="#indentation">→ indentation</a></li>
<ul>
</div>
<div class="wrapper">
<p class="titre">Réglages des styles graphiques du texte. La police de caractère utilisée est la <a href="https://fonts.google.com/specimen/Work+Sans" target="_blank">Work Sans.</a></p>
<br><br>
<p>Hello world!</p> <p class="code">font-family: 'Work Sans', sans-serif;<br>font-size: 28px;</p>
<hr class="style">
<p id="couleur" class="titre">la couleur du texte ↓</p>
<p class="color1">Hello world!</p> <p class="code">color: red;</p>
<p class="color2">Hello world!</p> <p class="code">color: #05ffb0;</p>
<p class="color3">Hello world!</p> <p class="code">color: rgba(20, 0, 100, 0.4);</p>
<hr class="style">
<p id="taille" class="titre">la taille du texte ↓</p>
<p class="size1">Hello world!</p> <p class="code">font-size: 32px;</p>
<p class="size2">Hello world!</p> <p class="code">font-size: 3em;</p>
<hr class="style">
<p id="italique" class="titre">le texte en italique ↓</p>
<p class="italic1">Hello world!</p> <p class="code">font-style: italic;</p>
<hr class="style">
<p id="graisses" class="titre">différentes graisses ↓</p>
<p class="weight1">Hello world!</p> <p class="code">font-weight: 200;</p>
<p class="weight2">Hello world!</p> <p class="code">font-weight: 400;</p>
<p class="weight3">Hello world!</p> <p class="code">font-weight: 500;</p>
<p class="weight4">Hello world!</p> <p class="code">font-weight: 700;</p>
<p class="weight5">Hello world!</p> <p class="code">font-weight: 900;</p>
<hr class="style">
<p id="interlettrage" class="titre">l'interlettrage ↓</p>
<p class="letterspacing1">Hello world!</p> <p class="code">letter-spacing: 8px;</p>
<hr class="style">
<p id="espacemots" class="titre">l'écartement entre les mots ↓</p>
<p class="wordspacing">Lorem ipsum dolor sit amet</p> <p class="code">word-spacing: 15px;</p>
<hr class="style">
<p id="souligne" class="titre">le texte souligné ↓</p>
<p class="underline">Hello world!</p> <p class="code">text-decoration: underline;</p>
<hr class="style">
<p id="capitale" class="titre">le texte en capitale ↓</p>
<p class="capitale">Hello world!</p> <p class="code">text-transform: uppercase;</p>
<hr class="style">
<p id="1capitale" class="titre">la 1ère lettre de chaque mot est en capitale ↓</p>
<p class="capitale2">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam semper diam at erat pulvinar, at pulvinar felis blandit. Vestibulum volutpat tellus diam, consequat gravida libero rhoncus ut.</p> <p class="code">text-transform: capitalize;</p>
<hr class="style">
<p id="interlignage" class="titre">l'interlignage du texte ↓</p>
<p class="lineheight1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam semper diam at erat pulvinar, at pulvinar felis blandit. Vestibulum volutpat tellus diam, consequat gravida libero rhoncus ut.</p> <p class="code">line-height: 32px;</p>
<hr class="style">
<p id="droite" class="titre">le texte est ferré à droite ↓</p>
<p class="right">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam semper diam at erat pulvinar, at pulvinar felis blandit. Vestibulum volutpat tellus diam, consequat gravida libero rhoncus ut.</p> <p class="code">text-align: right;</p>
<hr class="style">
<p id="centre" class="titre">le texte est centré ↓</p>
<p class="center">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam semper diam at erat pulvinar, at pulvinar felis blandit. Vestibulum volutpat tellus diam, consequat gravida libero rhoncus ut.</p> <p class="code">text-align: center;</p>
<hr class="style">
<p id="justifie" class="titre">le texte est justifié ↓</p>
<p class="justify">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam semper diam at erat pulvinar, at pulvinar felis blandit. Vestibulum volutpat tellus diam, consequat gravida libero rhoncus ut.</p> <p class="code">text-align: justify;</p>
<hr class="style">
<p id="indentation" class="titre">l'indentation de la 1ère ligne ↓</p>
<p class="indentation">Dein Syria per speciosam interpatet diffusa planitiem. hanc nobilitat Antiochia, mundo cognita civitas, cui non certaverit alia advecticiis ita adfluere copiis et internis, et Laodicia et Apamia itidemque Seleucia iam inde a primis auspiciis florentissimae.</p>
<p class="code">text-indent: 50px;</p>
<p class="indentation">Quare hoc quidem praeceptum, cuiuscumque est, ad tollendam amicitiam valet; illud potius praecipiendum fuit, ut eam diligentiam adhiberemus in amicitiis comparandis, ut ne quando amare inciperemus eum, quem aliquando odisse possemus. Quin etiam si minus felices in diligendo fuissemus, ferendum id Scipio potius quam inimicitiarum tempus cogitandum putabat.
Et quoniam mirari posse quosdam peregrinos existimo haec lecturos forsitan, si contigerit, quamobrem cum oratio ad ea monstranda deflexerit quae Romae gererentur, nihil praeter seditiones narratur et tabernas et vilitates harum similis alias, summatim causas perstringam nusquam a veritate sponte propria digressurus.
Accedebant enim eius asperitati, ubi inminuta vel laesa amplitudo imperii dicebatur, et iracundae suspicionum quantitati proximorum cruentae blanditiae exaggerantium incidentia et dolere inpendio simulantium, si principis periclitetur vita, a cuius salute velut filo pendere statum orbis terrarum fictis vocibus exclamabant.
Eo adducta re per Isauriam, rege Persarum bellis finitimis inligato repellenteque a conlimitiis suis ferocissimas gentes, quae mente quadam versabili hostiliter eum saepe incessunt et in nos arma moventem aliquotiens iuvant, Nohodares quidam nomine e numero optimatum, incursare Mesopotamiam quotiens copia dederit ordinatus, explorabat nostra sollicite, si repperisset usquam locum vi subita perrupturus.</p>
<p class="indentation">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam semper diam at erat pulvinar, at pulvinar felis blandit. Vestibulum volutpat tellus diam, consequat gravida libero rhoncus ut.</p>
</div>
<!--
<div style="width:100%; height:900px;"></div>-->
.wrapper {
margin: 0 auto;
max-width: 700px;
}
body {
background-color: #f2f2f2;/*couleur du fond de la page*/
}
.menu {
position: fixed;
top: 0;
left: 5px;
}
.menu ul {
list-style:none;
}
.menu li {
font-family: monospace;
font-size: 12px;
}
/*le style de la ligne*/
hr.style{
border-top: 3px solid white;
}
p.titre {
font-variant: small-caps;
font-size: 18px;
font-weight: 700;
}
a {
color: black;
}
.menu a {
color: black;
text-decoration: none;
}
.menu a:hover {
text-decoration: underline;
}
.code {
background: white;
border-radius: 2px;
color: rgba(0,0,0,0.7);
display: inline-block;
padding: 0.1em 0.5em 0.15em;
font-size: 11px;
font-family: monospace;
margin: 0 0 10px 20px;
}
@media handheld, only screen and (max-width: 767px) {
.menu {
display: none;
}
}
/*LES DIFFÉRENTS STYLES DE TEXTES*/
/*Lien vers la Google font. Attention ! Pensez à bien sélectionner les graisses dans les réglages de la page de la font.*/
@import url('https://fonts.googleapis.com/css?family=Work+Sans:200,400,500,700,900');
p {
font-family: 'Work Sans', sans-serif; /*régle css pour définir la typo*/
font-size: 28px;/*la taille du texte*/
margin: 15px 0 15px 0; /*top,right,bottom,left*/
}
p.color1 {
color: red; /*la couleur du texte*/
}
p.color2 {
color: #05ffb0; /*la couleur du texte*/
}
p.color3 {
color: rgba(20, 0, 100, 0.4); /*couleur en rba avec la transparence alpha*/
}
p.size1 {
font-size: 32px; /*la taille du texte*/
}
p.size2 {
font-size: 3em; /*la taille du texte*/
}
p.italic1 {
font-style: italic;
}
p.weight1 {
font-weight: 200; /*l'épaisseur de la typo*/
}
p.weight2 {
font-weight: 400; /*l'épaisseur de la typo*/
}
p.weight3 {
font-weight: 500; /*l'épaisseur de la typo*/
}
p.weight4 {
font-weight: 700; /*l'épaisseur de la typo*/
}
p.weight5 {
font-weight: 900; /*l'épaisseur de la typo*/
}
p.letterspacing1 {
letter-spacing: 8px; /*l'interlettrage*/
}
p.wordspacing {
word-spacing: 15px; /*l'écartement entre les mots*/
}
p.underline {
text-decoration: underline; /*soulignement*/
}
p.capitale {
text-transform: uppercase;/*texte en capitale*/
}
p.capitale2 {
text-transform: capitalize;/*la 1ère lettre de chaque mot est en capitale*/
font-size: 22px;
}
p.lineheight1 {
line-height: 32px; /*l'interlignage*/
font-size: 22px;
}
p.right {
text-align: right; /*texte ferré à droite*/
font-size: 22px;
}
p.center {
text-align: center; /*texte centré*/
font-size: 22px;
}
p.justify {
text-align: justify; /*texte justifié*/
font-size: 22px;
}
p.indentation {
text-indent: 50px; /*retrait de la 1ere ligne*/
font-size: 22px;
}
Also see: Tab Triggers