Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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.

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

              
                <h1>A Bug with <code>:has()</code> selector in Safari Technology Preview 137</h1>
<p>It appears that there is a bug with the newly supported :has() selector.</p>
<p>In the example below, only the first <code>
    &lt;a&gt;</code> element should be matched, but the actual result is that even the link without a span element is matched.</p>
<p>Both elements appear with the purple background using the following code:<br> <code>a:has(span) { background: rebeccapurple; }</code></p>

<a href="#2">
  <span>SPAN</span>
</a>

<a href="#1">
  NO SPAN
</a>

<p class="author">
  <a href="https://twitter.com/cssweekly"><img src="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e %3c!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e %3csvg width='100%25' height='100%25' viewBox='0 0 270 220' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' xml:space='preserve' xmlns:serif='http://www.serif.com/' style='fill-rule:evenodd%3bclip-rule:evenodd%3bstroke-linejoin:round%3bstroke-miterlimit:2%3b'%3e%3cg transform='matrix(0.906028%2c0%2c0%2c0.906028%2c-489.419%2c-516.301)'%3e%3cpath d='M633.9%2c812.041C746.36%2c812.041 807.86%2c718.873 807.86%2c638.081C807.86%2c635.435 807.806%2c632.801 807.687%2c630.178C819.625%2c621.548 830.001%2c610.778 838.185%2c598.518C827.23%2c603.388 815.441%2c606.666 803.074%2c608.144C815.697%2c600.575 825.388%2c588.601 829.96%2c574.327C818.147%2c581.33 805.065%2c586.42 791.136%2c589.168C779.979%2c577.284 764.095%2c569.851 746.507%2c569.851C712.743%2c569.851 685.363%2c597.232 685.363%2c630.983C685.363%2c635.781 685.9%2c640.447 686.949%2c644.924C636.134%2c642.367 591.075%2c618.038 560.919%2c581.044C555.668%2c590.079 552.64%2c600.575 552.64%2c611.774C552.64%2c632.986 563.434%2c651.712 579.848%2c662.667C569.817%2c662.357 560.394%2c659.603 552.158%2c655.02C552.149%2c655.277 552.149%2c655.527 552.149%2c655.801C552.149%2c685.411 573.224%2c710.133 601.2%2c715.735C596.063%2c717.135 590.657%2c717.886 585.078%2c717.886C581.145%2c717.886 577.312%2c717.499 573.587%2c716.784C581.371%2c741.077 603.942%2c758.755 630.702%2c759.249C609.776%2c775.651 583.415%2c785.42 554.765%2c785.42C549.836%2c785.42 544.967%2c785.139 540.181%2c784.573C567.24%2c801.917 599.37%2c812.037 633.903%2c812.037' style='fill:rgb(29%2c161%2c242)%3bfill-rule:nonzero%3b'/%3e%3c/g%3e%3c/svg%3e"> Zoran Jambor / CSS Weekly</a>
</p>
              
            
!

CSS

              
                a:has(span) {
  background: rebeccapurple;
  color: #fff;
}

/* Page styling, unrelated to the bug */
body {
  padding: 1rem 2rem 3rem;
  text-align: center;
}

a {
  display: block;
  width: 20vw;
  padding: 1.5rem 1rem;
  border-radius: 3px;
  margin: 1rem auto 0;
}

h1 {
  margin: 2rem auto 1rem;
  max-width: 40ch;
}

p {
  margin: 1.5rem auto;
  max-width: 60ch;
  line-height: 1.5;
}

.author {
  margin: 3rem auto;
}

.author a {
  display: flex;
  justify-content: center;
  color: #1da1f2;
  text-decoration: none;
}

img {
  display: inline;
  width: 1.5em;
  height: 1.5em;
  margin-right: 0.5rem;
}

              
            
!

JS

              
                
              
            
!
999px

Console