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. 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

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

              
                <!DOCTYPE html>
<html>
<head>
    <title>CSS Selectors</title>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>

<body>
    <h1>Ion and Marie</h1>

    <div id="cat">
        <p>Hi, I am Ion. I think I make sounds that sounds like Meaw Meaw. But some people argue that I sounds like Eeao Eeao.</p>
        <p>Anyway, I have three kittens. They are: </p>

        <ul>
            <li class="kittens">Milli</li>
            <li class="kittens">Tigger</li>
            <li class="kittens" title="I'm brown!">Chole</li>
        </ul>
    </div>

    <div id="dog">
        <p>Hey Man! I'm Marie. I think I make sounds that sounds like Ghaw Ghaw. But some people argue it sounds like Vhaw Vhaw.</p>
        <p>Anyway, I have three puppies. They are: </p>

        <ul>
            <li class="puppies">Buddy</li>
            <li class="puppies">Ruddy</li>
            <li class="puppies">Huddy</li>
        </ul>
    </div>

    <p>Ion and Marie are friends. Though all the Kittens and Puppies keeps fighting all day, but that just the way the have fun. They are friends too.</p>
    <p>The world is all Sunshine and Rainbow here!</p>
</body>
</html>
              
            
!

CSS

              
                body {
    width: 70%;
    margin: 0 auto;
}

/*
* {
    background-color: darkviolet;
    color: white;
}
This is the Universal CSS Selector*/


/*
h1 {
    background-color: darkviolet;
    color: white;
}
This is the type Or, element CSS Selector */


/*
#cat {
    background-color: darkviolet;
    color: white;
}
This is the id Selector*/


/*
.kittens {
    background-color: darkviolet;
    color: white;
}
This is the class selector*/


/*#dog ul {
    background-color: darkviolet;
    color: white;
}
This is the Descedant Selector*/




/*body > p {
    background-color: darkviolet;
    color: white;
}
This is child selector.*/




/*div ~ p {
    background-color: darkviolet;
    color: white;
}
This is General Sibling Selector*/



/*
div + p {
    background-color: darkviolet;
    color: white;
}
Adjacent Sibling Selector*/



/*[title="I'm brown!"] {
    background-color: darkviolet;
    color: white;
}
This is Attribute Selector*/


/*
#cat:hover, #dog:hover {
    background-color: darkviolet;
    color: white;
}
This is pseudo Selector*/


/*
ul li:nth-child(3) {
    background-color: darkviolet;
    color: white;
}
This is positional Or, nth-child Selector*/
              
            
!

JS

              
                
              
            
!
999px

Console