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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              <body>
<h1>SVG dans un background</h1>
<h2>Image externe</h2>
La classe .bg
<div class="bg">ici la class .bg avec du texte pour voir l'effet, pas de hauteur fixée</div>
<br>
La class .bg en em
<div class="bgem">ici la class .bg en em avec du texte pour voir l'effet, pas de hauteur fixée</div>  
<br>
<div class="super-bg">ici la class .super-bg qui utilise les propiétés racourcies pas de hauteur fixée et un background plus grand</div>
 <br>
 <div class="bg-posit">ici la class .bg-posit qui utilise pas de hauteur fixée, un background plus grand et un potionnement pour l'image</div>
<hr>
<h2>Image In-Line</h2>
<p>tous les styles sur une seule classe</p>
<a class="tel" href="#">01.02.03.04.05</a>
<p>idem avec attribut de présentation dans le SVG (fill=red)</p>
<a class="tel-rouge" href="#">01.02.03.04.05</a>
<p>before avec background</p>
<a class="beforetel" href="#">01.02.03.04.05</a>
<hr>
responsive https://tympanus.net/codrops/2014/08/19/making-svgs-responsive-with-css/
<div class="responsif-hack"></div>
</body>
            
          
!
            
              html{
  font-size:62.5%; /* 16px = 10px soit 1em/rem */
}
body{
  font-size:14px;
}

.bg{
  width:100px;
  padding:10px;
  padding-left:80px; /* Pour le placement du texte*/       background:url("http://www.alsacreations.com/xmedia/tuto/svg/kiwi.svg");
background-color:red;
background-repeat: no-repeat;
background-size: 32px 30px;
background-position: left 10px top 5px;
}
.bgem{
font-size:1.4rem; /* le referant des em */
width:9.375em; /* 150px */
padding:0.625em;
padding-left:5.625em; /* Pour le placement du texte*/       background:url("http://www.alsacreations.com/xmedia/tuto/svg/kiwi.svg");
background-color:red;
background-repeat: no-repeat;
background-size: 2em 1.875em;
background-position: left 0.625em top 0.3125em; 
}
.super-bg{
width:200px;
padding:10px;
padding-left:90px;   
 background:url("http://www.alsacreations.com/xmedia/tuto/svg/kiwi.svg") no-repeat red left 10px top 5px;
 background-size: 64px 64px;
 /*background-size:cover;
  background-size:contain;*/
}
.bg-posit{
width:200px;
padding:10px;
padding-left:90px;   
 background:url("http://www.alsacreations.com/xmedia/tuto/svg/kiwi.svg") no-repeat red left 10px top 28px;
 background-size: 64px 64px;
 background-color:green;
 color:#fff;
}


/*
IMAGE EN BACKGROUND tout en un
*/
.tel{
	display: block;
  width: 240px;
	padding-left: 99px;
	text-decoration: none;
	font-size: 36px;
	line-height: 64px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path class="path1" d="M704 640c-64 64-64 128-128 128s-128-64-192-128-128-128-128-192 64-64 128-128-128-256-192-256-192 192-192 192c0 128 131.5 387.5 256 512s384 256 512 256c0 0 192-128 192-192s-192-256-256-192z"></path></svg>');
  background-repeat: no-repeat;
  background-position: left;
  background-size: 107px 50px;
	background-color: aliceblue;
}

.tel-rouge{
	display: block;
  width: 240px;
	padding-left: 99px;
	text-decoration: none;
	font-size: 36px;
	line-height: 64px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="red"  viewBox="0 0 1024 1024"><path class="path1" d="M704 640c-64 64-64 128-128 128s-128-64-192-128-128-128-128-192 64-64 128-128-128-256-192-256-192 192-192 192c0 128 131.5 387.5 256 512s384 256 512 256c0 0 192-128 192-192s-192-256-256-192z"></path></svg>');
  background-repeat: no-repeat;
  background-position: left;
  background-size: 107px 50px;
	background-color: aliceblue;
  }

/*
BEFORE background
*/

.beforetel{
	  display: block;
    width: 300px;
    padding: 20px;
    text-align: center;
    text-decoration: none;
    font-size: 36px;
    background-color: aliceblue;
}
.beforetel:before{
	content:'';
	display: block;
	width: 64px;
	height: 64px;
	margin: 0 auto;
	background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path class="path1" d="M704 640c-64 64-64 128-128 128s-128-64-192-128-128-128-128-192 64-64 128-128-128-256-192-256-192 192-192 192c0 128 131.5 387.5 256 512s384 256 512 256c0 0 192-128 192-192s-192-256-256-192z"></path></svg>');
    background-repeat: no-repeat;	
}

.responsif-hack{
  width: 25%;
  height:0;
  /* padding-top: (svg-height / svg-width) * width-value; */
  /* ( ( 1024 / 1024 ) x (25/100) ) x 100 */  
  padding-top: 25%; 
  background: url(http://www.alsacreations.com/xmedia/tuto/svg/kiwi.svg);
  background-size: cover;
  background-repeat: no-repeat;
  background-color:red;
}

            
          
!
999px
Loading ..................

Console