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

              
                
    <main id="main-doc">
        <!--Start of Navbar-->
          <nav id="navbar">
                  <ul>
                      <header>
                          <h1>SASS Documentation</h1>
                      </header>
                      <li> <a href="#Why_SASS!" class="nav-link">Why SASS!</a></li>
                      <li> <a href="#Preprocessing" class="nav-link">Preprocessing</a></li>
                      <li> <a href="#Variables" class="nav-link">Variables</a></li>
                      <li> <a href="#Nesting" class="nav-link">Nesting</a></li>
                      <li> <a href="#Partials" class="nav-link">Partials</a></li>
                      <li> <a href="#Modules" class="nav-link">Modules</a></li>
                      <li> <a href="#Mixins" class="nav-link">Mixins</a></li>
                      <li> <a href="#Extend/Inheritance" class="nav-link">Extend/Inheritance</a></li>
                      <li> <a href="#Operators" class="nav-link">Operators</a></li>
                  </ul>       
          </nav>
        <!--End of Navbar-->
        
        
        <!--Start of Main section -->
       <section id="Why_SASS!" class="main-section">
          <header>Why SASS!</header>
          <ul>
              <li>It's CSS syntax friendly</li>
              <li>It offers variables for whatever you want</li>
              <li>It uses nested syntax</li>
              <li>It includes mixins </li>
              <li>You can divide and conquer</li>
              <li>It has a large community and is well documented</li>
              <li>If you know SASS, you can customize Bootstrap 4</li>
          </ul>
        </section>
      
       <section id="Preprocessing" class="main-section">
           <header>Preprocessing</header>
           <article>
              <p>
              CSS on its own can be fun, but stylesheets are getting larger, more complex, and harder to maintain. This is where a preprocessor can help. Sass has features that don't exist in CSS yet like nesting, mixins, inheritance, and other nifty goodies that help you write robust, maintainable CSS.
             </p>
              <p>
              Once you start tinkering with Sass, it will take your preprocessed Sass file and save it as a normal CSS file that you can use in your website.
              </p>
              <p>
              The most direct way to make this happen is in your terminal. Once Sass is installed, you can compile your Sass to CSS using the sass command. You'll need to tell Sass which file to build from, and where to output CSS to. For example, running sass input.scss output.css from your terminal would take a single Sass file, input.scss, and compile that file to output.css.
              </p>
              <p>
              You can also watch individual files or directories with the --watch flag. The watch flag tells Sass to watch your source files for changes, and re-compile CSS each time you save your Sass. If you wanted to watch (instead of manually build) your input.scss file, you'd just add the watch flag to your command, like so:
              </p>
              <code> 
              sass --watch input.scss output.css
          </code>
          <p> 
              You can watch and output to directories by using folder paths as your input and output, and separating them with a colon. In this example:
          </p>
          <code>
              sass --watch app/sass:public/stylesheets
          </code>
          <p>
              Sass would watch all files in the app/sass folder for changes, and compile CSS to the public/stylesheets folder.
          </p> 
          </article>
       </section>
       <section id="Variables" class="main-section">
           <header>Variables</header>
           <article>
              <p> 
              Think of variables as a way to store information that you want to reuse throughout your stylesheet. You can store things like colors, font stacks, or any CSS value you think you'll want to reuse. Sass uses the $ symbol to make something a variable. Here's an example: </p>
                   <code> 
              SCSSSassCSS
              SCSS SYNTAX
              $font-stack:    Helvetica, sans-serif;
              $primary-color: #333;
              
              body {
                font: 100% $font-stack;
                color: $primary-color;
              }
                  </code>
             <p> 
              When the Sass is processed, it takes the variables we define for the $font-stack and $primary-color and outputs normal CSS with our variable values placed in the CSS. This can be extremely powerful when working with brand colors and keeping them consistent throughout the site.
             </p> 
          </article>
          </section>
       <section id="Nesting" class="main-section">
           <header>Nesting</header>
           <article>
               <p>
            When writing HTML you've probably noticed that it has a clear nested and visual hierarchy. CSS, on the other hand, doesn't.

            Sass will let you nest your CSS selectors in a way that follows the same visual hierarchy of your HTML. Be aware that overly nested rules will result in over-qualified CSS that could prove hard to maintain and is generally considered bad practice.
            
            With that in mind, here's an example of some typical styles for a site's navigation:
            </p>
            <code> 
            SCSSSassCSS
            SCSS SYNTAX
            nav {
              ul {
                margin: 0;
                padding: 0;
                list-style: none;
              }
            
              li { display: inline-block; }
            
              a {
                display: block;
                padding: 6px 12px;
                text-decoration: none;
              }
            }
             </code>
            <p> 
            You'll notice that the ul, li, and a selectors are nested inside the nav selector. This is a great way to organize your CSS and make it more readable.
            </p>
           </article>
          </section>
       <section id="Partials" class="main-section">
           <header>Partials</header>
           <article>
              <p> 
              You can create partial Sass files that contain little snippets of CSS that you can include in other Sass files. This is a great way to modularize your CSS and help keep things easier to maintain. A partial is a Sass file named with a leading underscore. You might name it something like _partial.scss. The underscore lets Sass know that the file is only a partial file and that it should not be generated into a CSS file. Sass partials are used with the @use rule.
              </p> 
          </article>
          </section>
       <section id="Modules" class="main-section">
           <header>Modules</header>
           <article>
              <p> 
              You don't have to write all your Sass in a single file. You can split it up however you want with the @use rule. This rule loads another Sass file as a module, which means you can refer to its variables, mixins, and functions in your Sass file with a namespace based on the filename. Using a file will also include the CSS it generates in your compiled output!
              </p>
              <code>
      
             
              SCSSSassCSS
              SCSS SYNTAX
              // _base.scss
              $font-stack:    Helvetica, sans-serif;
              $primary-color: #333;
              
              body {
                font: 100% $font-stack;
                color: $primary-color;
              }
              // styles.scss
              @use 'base';
              
              .inverse {
                background-color: base.$primary-color;
                color: white;
              }
          </code>
          <p>
              Notice we're using @use 'base'; in the styles.scss file. When you use a file you don't need to include the file extension. Sass is smart and will figure it out for you.
          </p> 
          </article>
          </section>
       <section id="Mixins" class="main-section">
           <header>Mixins</header>
           <article>
              <p> 
              Some things in CSS are a bit tedious to write, especially with CSS3 and the many vendor prefixes that exist. A mixin lets you make groups of CSS declarations that you want to reuse throughout your site. You can even pass in values to make your mixin more flexible. A good use of a mixin is for vendor prefixes. Here's an example for theme.
          </p>
          <code> 
              SCSSSassCSS
              SCSS SYNTAX
              @mixin theme($theme: DarkGray) {
                background: $theme;
                box-shadow: 0 0 1px rgba($theme, .25);
                color: #fff;
              }
              
              .info {
                @include theme;
              }
              .alert {
                @include theme($theme: DarkRed);
              }
              .success {
                @include theme($theme: DarkGreen);
              }
          </code>
              <p>
              To create a mixin you use the @mixin directive and give it a name. We've named our mixin theme. We're also using the variable $theme inside the parentheses so we can pass in a theme of whatever we want. After you create your mixin, you can then use it as a CSS declaration starting with @include followed by the name of the mixin.
            </p> 
          </article>
          </section>
       <section id="Extend/Inheritance" class="main-section">
           <header>Extend/Inheritance</header>
           <article>
              <p> 
                  This is one of the most useful features of Sass. Using @extend lets you share a set of CSS properties from one selector to another. It helps keep your Sass very DRY. In our example we're going to create a simple series of messaging for errors, warnings and successes using another feature which goes hand in hand with extend, placeholder classes. A placeholder class is a special type of class that only prints when it is extended, and can help keep your compiled CSS neat and clean.
              </p> 
              <code> 
                  SCSSSassCSS
                  SCSS SYNTAX
                  /* This CSS will print because %message-shared is extended. */
                  %message-shared {
                    border: 1px solid #ccc;
                    padding: 10px;
                    color: #333;
                  }
                  
                  // This CSS won't print because %equal-heights is never extended.
                  %equal-heights {
                    display: flex;
                    flex-wrap: wrap;
                  }
                  
                  .message {
                    @extend %message-shared;
                  }
                  
                  .success {
                    @extend %message-shared;
                    border-color: green;
                  }
                  
                  .error {
                    @extend %message-shared;
                    border-color: red;
                  }
                  
                  .warning {
                    @extend %message-shared;
                    border-color: yellow;
                  }
              </code>
              <p> 
                  What the above code does is tells .message, .success, .error, and .warning to behave just like %message-shared. That means anywhere that %message-shared shows up, .message, .success, .error, & .warning will too. The magic happens in the generated CSS, where each of these classes will get the same CSS properties as %message-shared. This helps you avoid having to write multiple class names on HTML elements.
                  
                  You can extend most simple CSS selectors in addition to placeholder classes in Sass, but using placeholders is the easiest way to make sure you aren't extending a class that's nested elsewhere in your styles, which can result in unintended selectors in your CSS.
                  
                  Note that the CSS in %equal-heights isn't generated, because %equal-heights is never extended.
              </p> 
          </article>
          </section>
       <section id="Operators" class="main-section">
           <header>Operators</header>
           <article>
              <p> 
              Doing math in your CSS is very helpful. Sass has a handful of standard math operators like +, -, *, /, and %. In our example we're going to do some simple math to calculate widths for an aside & article.
                  </p>
                  <code> 
              SCSSSassCSS
              SCSS SYNTAX
              .container {
                width: 100%;
              }
              
              article[role="main"] {
                float: left;
                width: 600px / 960px * 100%;
              }
              
              aside[role="complementary"] {
                float: right;
                width: 300px / 960px * 100%;
              }
          </code>
          <p> 
              We've created a very simple fluid grid, based on 960px. Operations in Sass let us do something like take pixel values and convert them to percentages without much hassle.
          </p> 
          </article>
          </section>  
        <!--End of main section-->
      </main>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Domine&display=swap');

*{
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    background-color: #e5e5e5;
}

#navbar {
    height: 100%;
    width: 230px;
    position: fixed;
 
    background-color: #14213d;
    border-radius: 3px;
    border: 1px solid black;
    top: 0;
    left: 0;
    padding-top: 10px;
  diplay: inline-block;
   
}

#navbar li {
    list-style: none;
    padding: 30px 2px 3px 1px;
    font-weight: 4rem; 
    margin-left: 5px;
}

#navbar li a {
    display: block;
    text-decoration: none;
    /*The cool thing I found out is that you should not target a alone, because you can have "a" somewhere else and you change their style accidentally.*/
    font-family: 'Domine', serif;
    color:#e5e5e5;
}

#navbar li a:hover {
    border-bottom: 3px solid #fca311;
    font-weight: bold;
    width: 100%;
    text-align: center;
}

header{
    color: #fca311;
    font-family: 'Domine', serif;
    text-align: center;
    text-shadow: 1px 1px 2px rgb(5, 5, 5);
    font-size: 15px;
}

.main-section {
    margin: auto;
    text-align: left;
    margin-left: 250px;
    padding-top: 15px;
  overflow-x: hidden;
    
}
#navbar ul {
    height: 88%;
    padding: 0;
    overflow-y:scroll;
    overflow-x:hidden;
  
  }

  code {
      background-color: white;
      display: block;
      font-weight: bold;
      white-space: pre;
  }

@media only screen and (max-width: 400px) { 
  #main-doc {
    margin-left: -10px;
    
  }
}

@media only screen and (max-width: 815px) { 
  #navbar ul {
  height: 88%;
  padding: 0;
  overflow-y: auto; 
  overflow-x: hidden;
    
  }
}


              
            
!

JS

              
                
              
            
!
999px

Console