cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

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.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <!-- cet id "hello" est géré avec javascript ET CSS -->
<p id="hello">HELLO ALL!</p>

<!-- cet id "rdm" est géré avec javascript ET CSS -->
<p id="rdm">RANDOM!</p>

<!-- cet id "unmot" est géré avec javascript ET CSS -->
<p id="unmot">un mot</p>
            
          
!
            
              p {
	width: 600px;
	color: crimson;
	padding: 20px;
	font-family: helvetica;
	text-align:center;
	font-size: 24px;
	position:relative;
	left:0;
	right:0;
	margin:auto;
}

#hello {
	font-family: helvetica;
	font-weight: 900;
	color: white;
	padding: 50px;
	text-align: center;
}

#rdm {
	font-family: 'Baloo', cursive;
	color: blueviolet;
}

#unmot {
	color: black;
}
            
          
!
            
              var c;
var a;

var toto;
var dog;

var rdm;

//la variable unmot
var unmot;


function setup() {
	
	var myDiv;
	myDiv = createDiv('Cette balise div est créée en javascript avec la fonction createDiv');

	
	createP("Voici un nombre choisi au hasard entre 0 et 10 : " + random(10)); //le style de ce texte se trouve dans le CSS avec p
	
	c = select('#hello'); //ici on selectionne le paragraphe avec l'id #hello
	
	a = select('#hello');
	
	toto = random(10,68);
	dog = color(random(255));
	
	rdm = select('#rdm');
	
	unmot = select('#unmot');//la variable unmot est assignée avec l'id #unmot
	unmot.style('font-size', '90px');//la font size est déterminée en javascript avec la fonction style
	
}



function draw() {
	a.style('font-size', toto + 'px'); //la taille de la font de l'id #hello est en random entre 10 et 68px
	
	c.style('background-color', dog); //la couleur de fond du paragraphe avec l'id #hello est en random entre 0 et 255 nuances de gris
	
	rdm.style('font-size', mouseX + 'px');

	
}


            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console