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. You can use the CSS from another Pen by using it's URL and the proper URL extention.
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.
<head>
<title>Sherbrooke 1881</title>
<meta charset="UTF-8">
</head>
<body>
<div style="height: 1000px;"></div>
<div class = "intro">Au tournant du 20e siècle, Sherbrooke est déjà une ville industrielle prospère. Depuis l'arrivée du chemin de fer en 1852, les industries se sont multipliées et ont attiré la main-d'œuvre. D'environ 3000 habitants en 1851, la population passe à 7446 habitants en 1881 pour atteindre 23 522 habitants en 1921. Dès 1897, le tramway est mis en service pour faciliter les déplacements de la population croissante. BANQ</div> -->
<div style="height: 1000px;"></div>
<div class = "museeBA">Le bureau de poste a été construit en 1885 sur la rue Dufferin. Cette artère portait autrefois le nom de rue Commerciale jusqu'à ce que les boutiques et les banques se déplacent sur la rue Wellington. BANQ</div> -->
<div style="height: 1000px;"></div>
<div id="map"></div>
</body>
.intro {
background: black;
padding: 40px;
font-family: 'Pattaya', sans-serif;
text-align: justify;
color: white;
font-size: 25px;
line-height: 35px;
font-weight: normal;
z-index: 999;
display: flex;
justify-content: left;
align-items: left;
flex-direction: column;
overflow: hidden;
width: 30%;
position: relative;
border-style: solid;
border-color: red;
border-widht: 5px;
margin-left: 2%;
border-radius: 2em;
}
.museeBA {
background: black;
padding: 40px;
font-family: 'Pattaya', sans-serif;
text-align: justify;
color: white;
font-size: 25px;
line-height: 35px;
font-weight: normal;
z-index: 999;
display: flex;
justify-content: left;
align-items: left;
flex-direction: column;
overflow: hidden;
width: 30%;
position: relative;
border-style: solid;
border-color: red;
border-widht: 5px;
border-radius: 2em;
float:right;
margin-right: 2%;
}
html, body {
padding: 0;
margin: 0;
}
#map {
position:fixed;
top:0; bottom:0;
height: 100%;
width: 100vw;
}
gsap.registerPlugin(ScrollTrigger)
/*c'est une bonne pratique de prévenir le navigateur qu'on utilise ici une ressource externe*/
var map;
var iiifLayers = {};
map = L.map('map', {
center: [0, 0],
crs: L.CRS.Simple,
//comme il n'y a pas de crs (ex. wsg84), on le précise avec cette ligne
zoom: 10,
zoomControl: false,
zoomAnimation: false,
fadeAnimation: false,
attributionControl: false,
});
var manifestUrl = 'https://www.loc.gov/item/95684855/manifest.json';
//c'est le manifeste trouvé sur le site de la LOC
//ce qui suit est en jQuery
$.getJSON(manifestUrl, function(data) {
// Pour chaque image, créez un objet L.TileLayer.Iiif et ajoutez-le à un littéral d'objet pour le contrôle de calque
$.each(data.sequences[0].canvases, function(_, val) {
iiifLayers[val.label] = L.tileLayer.iiif(val.images[0].resource.service['@id'] + '/info.json');
});
// Accédez au premier objet iiif et ajoutez-le à la carte
iiifLayers[Object.keys(iiifLayers)[0]].addTo(map);
});
map.dragging.disable();
map.touchZoom.disable();
map.doubleClickZoom.disable();
map.scrollWheelZoom.disable();
map.boxZoom.disable();
map.keyboard.disable();
if (map.tap) map.tap.disable();
document.getElementById('map').style.cursor='default';
ScrollTrigger.create({
trigger: ".intro", /*c'est l'élément déclencheur*/
start: "top center", /*on définit où l'on veut que l'animation soit déclenchée, soit ici au milieu de la page*/
onEnter: () => map.flyTo([-150, 150], 3),/*on utilise la Arrow Function, qui est juste une façon plus courte en JS de définir une fonction; voir https://www.w3schools.com/Js/js_arrow_function.asp*/
animate: "true",
duration: 2,
markers: "true" /*permet de visualiser dans Codepen le début et la fin de l'animation; ne pas inclure dans votre projet final*/
})
ScrollTrigger.create({
trigger: ".museeBA", /*c'est l'élément déclencheur*/
start: "top center", /*on définit où l'on veut que l'animation soit déclenchée, soit ici au milieu de la page*/
onEnter: () => map.flyTo([-170, 300], 4),/*on utilise la Arrow Function, qui est juste une façon plus courte en JS de définir une fonction; voir https://www.w3schools.com/Js/js_arrow_function.asp*/
animate: "true",
duration: 1.5,
markers: "true", /*permet de visualiser dans Codepen le début et la fin de l'animation; ne pas inclure dans votre projet final*/
})
Also see: Tab Triggers