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

              
                .flag
  .union
    .stars
              
            
!

CSS

              
                /*
 * CSS is Patrotic
 *   By Ildar Sagdejev ( https://twitter.com/tknomad )
 *
 * Official flag proportions:
 *   http://www.usflag.org/flagspecs.html
 */

//
// Parameters
//
h = 40vw   // "hoist"
w = h * 1.9 // "fly"

color_star = white
color_union = darken(#2980B9, 40%)
colors_stripes = (1/7 * 100%), (2/7 * 100%),(3/7 * 100%),(4/7 * 100%),(5/7 * 100%),(6/7 * 100%),(7/7 * 100%)

//
// Automatic
//
w_union = (h * 0.76)
h_union = (h * 7/13)
margin_union = h * (0.054 - 0.0616/2)

*
  box-sizing border-box
  
body
  display flex
  align-items center
  justify-content center
  height 100vh
  width 100vw

.flag
  width w
  height h
  //background-image linear-gradient(colors_stripes[0] 50%, colors_stripes[1] 50%)
  background \
 linear-gradient(180deg, 
  #e74c3c 0%, 
  #e74c3c colors_stripes[0], 
  #e67e22 colors_stripes[0], 
  #e67e22 colors_stripes[1], 
  #f1c40f colors_stripes[1], 
  #f1c40f colors_stripes[2], 
  #2ecc71 colors_stripes[2], 
  #2ecc71 colors_stripes[3], 
  #3498db colors_stripes[3], 
  #3498db colors_stripes[4], 
  #2980b9 colors_stripes[4], 
  #2980b9 colors_stripes[5], 
  #9b59b6 colors_stripes[5], 
  #9b59b6 100%)
  //background-size 1px (2 * h / 13)
  
.union
  width w_union
  height h_union
  background-color color_union
  position relative
    
.stars
  width w_union - 2 * margin_union
  height h_union - 2 * margin_union
  margin margin_union
  position absolute
  tilt_bottom = 31.9deg
  tilt_side   = 69deg
  tilt_tall   = 144deg
  stop_bottom = 5.2%
  stop_side   = 9.4%
  stop_tall   = 9.3%
  angles = -(tilt_bottom), tilt_bottom, -(tilt_side), tilt_side, -(tilt_tall), tilt_tall
  stops = stop_bottom, stop_side, stop_tall
  offsets_x = -16.02%, 6.1% // left side, right side
  offsets_y = 13.8%, 6.8%   // point up, point down
  colors = color_star, color_union
  dx = 11px
  dy = 14.2px
  // Inspired by: http://lea.verou.me/css3patterns/#stars
  background \
    linear-gradient(angles[0], colors[1] stops[0], transparent 0) offsets_x[0] offsets_y[0],
    linear-gradient(angles[1], colors[1] stops[0], transparent 0) offsets_x[1] offsets_y[0],
    linear-gradient(angles[2], colors[0] stops[1], transparent 0) offsets_x[0] offsets_y[0],
    linear-gradient(angles[3], colors[0] stops[1], transparent 0) offsets_x[1] offsets_y[0],
    linear-gradient(angles[4], colors[0] stops[2], transparent 0) offsets_x[0] offsets_y[1],
    linear-gradient(angles[5], colors[0] stops[2], transparent 0) offsets_x[1] offsets_y[1],
    linear-gradient(angles[0], colors[1] stops[0], transparent 0) offsets_x[0]+dx offsets_y[0]+dy,
    linear-gradient(angles[1], colors[1] stops[0], transparent 0) offsets_x[1]+dx offsets_y[0]+dy,
    linear-gradient(angles[2], colors[0] stops[1], transparent 0) offsets_x[0]+dx offsets_y[0]+dy,
    linear-gradient(angles[3], colors[0] stops[1], transparent 0) offsets_x[1]+dx offsets_y[0]+dy,
    linear-gradient(angles[4], colors[0] stops[2], transparent 0) offsets_x[0]+dx offsets_y[1]+dy,
    linear-gradient(angles[5], colors[0] stops[2], transparent 0) offsets_x[1]+dx offsets_y[1]+dy

  // 5.5 tiles across and 4.5 tiles vertically
  background-size (100/5.5)% (100/4.5)%

  

              
            
!

JS

              
                
              
            
!
999px

Console