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.

            
              <div class="parent">
  <div class="container">
    <h3>:nth-child</h3>
    <ul class="exemple1">
      <li>value 1</li>
      <li>value 2</li>
      <li>value 3</li>
      <li>value 4</li>
    </ul>

  </div>
  
  <div class="container">
    <h3>:nth-of-type</h3>
    <div class="exemple2">
      <div>div 1</div>
      <span>span 1</span>
      <div>div 2</div>
      <div>div 3</div>
      <span>span 2</span>      
      <span>span 3</span>
    </div>
  </div>
  
  <div class="container">
    <h3>:link & :visited</h3>
    <a href="http://lemonde.fr" class="exemple3" target="_blank">Le monde</a>
    <h3>:hover & :active</h3>
    <div class="exemple4">Hover & Click</div>
  </div>
    
  <div class="container">
    <h3>:focus, :enabled & : disabled</h3>
    <div class="exemple5">
      <input class="exemple5" value="test"/>
      <div class="hidden">help</div>        
    </div>
    <input class="exemple6" value="test2"/>
    <input class="exemple6" disabled="disabled" value="test3"/>
  </div>
  
  <div class="container">
    <h3>:checked</h3>
    <div>
      <input type="checkbox"/>
      <span>Regular checkbox</span>
    </div>
    <div class="exemple7">
      <input type="checkbox" id="checkbox1"/>
      <label for="checkbox1">Custom checkbox</label>
    </div>
  </div>
  
</div>
            
          
!
            
              .parent {
  display: flex;  
  background-color: #e8e8e8;
  width: 100vw;
  height: 100vw;
  font-family: arial;
  font-size: 14px;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 18%;
  margin: 20px;
  background-color: white;
  height: 180px;
  border-radius: 2px;
  box-shadow: 0 2px 2px 1.16px rgba(0,0,0,0.2);
}

.exemple1 {
  width: auto;
} 

.exemple1 li:nth-child(2) {
  color: red;
}

.exemple1 li:nth-child(2n + 1) {
  text-decoration: underline;
}

.exemple2 > span {
  display: block;
}

.exemple2 div:nth-child(2) {
  color: red;
}

.exemple2 div:nth-child(2) {
  color: red;
}

.exemple2 div:nth-of-type(2) {
  color: blue;
}

.exemple3:link {
  color: green;
}

.exemple3:visited {
  color: grey;
}

.exemple4 {
  border-radius: 2px;
  padding: 5px;
  background-color: blue;
  color: white;
  margin-top: 1px;
  transition: all 0.2s;
  box-shadow: 0 2px 2px 1.16px rgba(0,0,0,0.4);
  cursor: pointer;
}

.exemple4:hover {
  margin-bottom: 1px;
  margin-top: 0px;
  box-shadow: 0 4px 4px 1.16px rgba(0,0,0,0.4);
  background-color: darkBlue;
}

.exemple4:active {
  background-color: grey;
  margin-bottom: 0px;
  margin-top: 1px;
  box-shadow: 0 2px 2px 1.16px rgba(0,0,0,0.4);
}

.exemple5 {
  position: relative;
}

.hidden {
  display: none;
  position: absolute;
  right: -50px;
  top: 0px;
  width: 40px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  background-color: blue;
  color: white;
}

.hidden::before {
  content: " ";
  width: 0px;
  height: 0px;
  border-top: solid 10px transparent;
  border-left: solid 10px transparent;
  border-right: solid 10px blue;
  border-bottom: solid 10px transparent;
  position: absolute;
  top: 0px;
  left: -20px;
    
}

.exemple5 input:focus {
  color: blue;
}

.exemple5 input:focus + .hidden {
  display: block;
}

input.exemple6:enabled {
  color: red;
}

.exemple6 input:disabled {
  color: green;
}

.exemple7 {
  position: relative;
  margin: 10px;
  width: 150px;
  height: 30px;
  z-index: 0
}

.exemple7 input[type="checkbox"] {
  display: none;
}

.exemple7 > label {
  position: absolute;
  top: 0px;
  left: 0px;
  width: 100%;
  height: 100%;
  background-color: grey;
  color: white;
  border-radius: 2px;
  line-height: 30px;
  text-align: center;
  z-index: 1;
  cursor: pointer;
}

.exemple7 > label:hover {
   background-color: dimGrey; 
}

.exemple7 input[type="checkbox"]:checked + label {
  background-color: blue;
}

.exemple7 input[type="checkbox"]:checked + label:hover {
  background-color: darkBlue;
}
            
          
!
999px
Loading ..................

Console