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.

            
              <div class="divGauche">
	<strong>Texte à gauche</strong><br>
	Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi.
</div>


<div class="divDroite">
	<strong>Texte à droite</strong><br>
	Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi.
</div>



<div class="div1">absolute</div>
<div class="div2">fixed</div>


<!-- le div 3 contient le div 4. Le div 3 parent est positionné en relative et le div 4 enfant est positionné en relative. -->
<div class="div3">
	<div class="div4"></div>
</div>





<!-- Pour faire de l'espace dans la page afin de pouvoir scroller -->
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
            
          
!
            
              /*Positionner deux éléments l'un à gauche, l'autre à droite : float. Les éléments ne sont donc plus les un en dessous des autres.*/

.divGauche {
	color: teal;
	font-family: monospace;
	width: 400px;
	float: left;
}

.divDroite {
	color: teal;
	font-family: monospace;
	width: 400px;	
	float: left;
}

/*Les éléments s'alignent à gauche et à droite jusqu'à remplir l'espace de la page. Si l'espace est insuffisant, les éléments retournent à la ligne.
L'attribut clear nettoie les float
*/


.clear {
	clear: left; /*left, right; both*/
}




/*
Les types de positionnement :

position: absolute;
Positionner un élément par rapport à la fenêtre.

position: fixed;
Lorsque l'on scroll dans la page, l'élément reste fixé.

position: static;
Positionnement par défaut les uns par rapport aux autres (l'un en desosus de l'autre).

position: relative;
Replacer des éléments par rapport à un autre élément. L'élément "parent" est relative et l'élément "enfant" est absolute.
*/


.div1 {
	position: absolute;
	width: 300px;
	height: 300px;
	top: 300px;
	left: 40px;
	border: 2px solid teal;
	color: teal;
	font-family: monospace;
}

.div2 {
	position: fixed;
	width: 80px;
	height: 80px;
	top: 50px;
	right: 50px;
	border: 2px solid teal;
	color: teal;
	font-family: monospace;
}



.div3 {
	position: relative;
	width: 350px;
	height: 350px;
	top: 450px;
	left: 600px;
	background-color: teal;
}

.div4 {
	position: absolute;
	width: 50px;
	height: 50px;
	left: 0;
	right: 0;
	top: 150px; /*350 divisé par 2 = 175 moins 25 = 150px*/
	margin: auto;
	border: 2px solid white;
}



            
          
!
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