Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

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.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html lang="fr">

<head>
  <meta charset="utf-8" />
  <title>Visualiser des liens externes</title>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
</head>

<body>
  <header>
    <h1>Différencier les liens s'ouvrant dans un nouvel onglet</h1>
  </header>
  <main>
    <h2>jQuery dans CodePen</h2>
    <p>Pour que jQuery fonctionne, il faut cliquer sur les settings de la fenêtre JS et choisir "jQuery" dans la case "Quick Add"</p>
    <h2>Deux liens identiques, ou presque</h2>
    <p> il s'ouvre dans un autre onglet</p>
    <a href="http://www.manifeste-leaders.org/le-manifeste/" target="_blank">manifeste « de quels leaders avons-nous besoin ? » </a>
    <p> il s'ouvre dans cette fenêtre</p>
    <a href="http://www.manifeste-leaders.org/le-manifeste/">manifeste « de quels leaders avons-nous besoin ? »</a>
    <h2>et avec une image</h2>
    <p>Si le jquery ne s'applique pas</p>
    <a class="no-jquery" title="running with the seagulls by Ed Schipul, on Flickr" href="https://www.flickr.com/photos/eschipul/386762837" target="_blank">
      <img class="alignright" title="running with the seagulls by Ed Schipul, on Flickr" src="https://farm1.staticflickr.com/139/386762837_7baafc5878_n.jpg" alt="running with the seagulls" width="320" height="213" />
    </a>
    <p>Si le jquery s'applique</p>
    <a class="with-jquery" title="running with the seagulls by Ed Schipul, on Flickr" href="https://www.flickr.com/photos/eschipul/386762837" target="_blank">
      <img class="alignright" title="running with the seagulls by Ed Schipul, on Flickr" src="https://farm1.staticflickr.com/139/386762837_7baafc5878_n.jpg" alt="running with the seagulls" width="320" height="213" />
    </a>


  </main>
  <footer><a href="http://knowledge.parcours-performance.com/ajouter-classe-element-parent-jquery-css/" target="_blank">Tuto </a></footer>
</body>

</html>
              
            
!

CSS

              
                h2 {
  color: blue;
}

a[target="_blank"]::after {
  content: "\f08e";
  /* external-link */
  
  display: inline-block;
  font-family: FontAwesome;
  font-size: 90%;
  color: #660bab;
  text-decoration: underline;
  width: 17px;
  text-align: right;
}

a[target="_blank"].img-inside::after {
  content: "";
  display: inline-block;
}

footer {
  border-top: 4px solid blue;
  margin-top: 15px;
  padding-top: 10px;
}
              
            
!

JS

              
                		jQuery(document).ready(function() {
			jQuery("a.with-jquery:has(img)").addClass("img-inside");
			jQuery("figure:has(a.img-inside)").addClass("external");
		});
              
            
!
999px

Console