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

              
                <center>
<div id="menu">
<ul>
  <li><a href="#"> option 1 </a>
  <ul>
    <li> option 1.a 
      with long description which 
      a lil bit odd
     <ul>    
       <li> option copacabana </li>    
       <li> option worldcup </li>    
       <li> option beer jug </li>
       </ul>
    </li>
    <li> option 1.x </li>
    </ul>
  </li>
  <li><a href="#"> option 2 </a>
  <ul>
    <li> option 2.a </li>
    <li> option 2.b </li>
    <li> option 2.x </li>
    <li> short desc.
    <ul>
      <li>another submenu</li>
      <li>again</li>
      </ul>
    </li>
    </ul>
  <li>
    <a href="#"> option 3 </a>
     <ul> 
        <li> option 3.a
          <ul> 
            <li>some more</li>
          </ul>
          </li>
        <li> 
          option 3.b with quite long and
          rigorous description too.
       </li>
      </ul>
    </li>
</ul>
</div>
  
  
<br/><br/>
<span style="font-family:Calibri;font-weight:bold;font-size:0.6em;">Simplification no. #2 of <a target="_blank" href="https://line25.com/tutorials/how-to-create-a-pure-css-dropdown-menu">Pure CSS Drop Down Menu</a>, a great crystal clear tutorial by Chris Spooner</span>
  
</center>
              
            
!

CSS

              
                body
{
  font-family:Courier;
  font-weight:700;font-size:18px;
  background:#ced0ba;}

/*top menu style*/ 
#menu ul {
	padding: 0;
	list-style: none;
	position: relative;
	display: inline-block;}

/*set every list below the top list invisible*/
#menu ul ul {display:none;}

/*will display the list beneath top menu on hover*/
#menu ul li:hover > ul {display:block;}

/*back to top menu style*/
/*this can be used to add something between the top list and the 2nd list*/
     /*#menu ul:after {
	     content: ""; 
       clear: both; 
       display: block;}*/

#menu ul li {
  float:left;
  padding: 20px 40px;
  
/*space between the top menu which applies to other elements wrapped inside it*/
  margin:0 5px;
  
  background:#00ccff; 
  box-shadow: 0px 2px 5px grey;}

#menu ul li:hover {
  cursor:pointer; 
  background: #38d7ff;
  box-shadow: 0px 2px 3px grey;}
	
#menu ul li a {
  display: block; 
  color: black; 
  text-decoration: none;}

/*this is the 2nd menu (submenu) style*/ 
#menu ul ul {  
  padding:0px;
/*divide 100% width by 3 menu*/
  width:33.3%;
	position: absolute;top: 100%;
  
/*Need this to compensate the earlier padding and margin above 40 px + 5px*/
  margin-left:-45px;  
}

#menu ul ul li {
  float: none; 
  text-align:center;
	position: relative; 
  padding:10px;
  border-bottom:1px solid #23adcf;
  border-top:1px solid #5fdbfa;
  box-shadow: 0px 2px 5px grey;}

/*this is the 3rd list (sub-submenu) style*/
#menu ul ul ul { 
  position:absolute;
/*to compensate the 1px top border*/
  top:-1px;
/*position of the last submenu list*/
  left:100%;
/*arbitrarily trial and error width size*/
  width:120%;
  
/*need this to compensate the top menu margin 5px*/
  margin-left:-5px;}
              
            
!

JS

              
                //I put the comments to remind myself.
//Wanted to make it centered, with spaces. Success!
//For fun purpose and knowledge
              
            
!
999px

Console