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

              
                .daybox
  label
    input#switch_night(type="checkbox")
    .top
      .moon
      .cloud 
        .rain
        .rain.rain2
        .rain.rain3
      svg.temsvg
        circle(cx=0 cy=100 r=3)
        text(x=0 y=100) 28°C
        circle(cx=70 cy=80 r=3)
        text(x=70 y=80) 29°C
        circle(cx=140 cy=50 r=3)
        text(x=140 y=50) 31°C
        circle(cx=210 cy=70 r=3)
        text(x=210 y=70) 30°C
        circle(cx=280 cy=100 r=3)
        text(x=280 y=100) 28°C
        circle(cx=350 cy=110 r=3)
        text(x=350 y=110) 26°C


        polyline(points="0,100 70,80 140,50 210,70 280,100 350,110 420,80 560,560")


      .text_area
        .temperature 28°C
        .infos
          .address 屏東縣高樹鄉青山村
          .time 星期五 22:00
    .bottom
      .dayweather
        h3 MON
        svg(viewbox=" -50 -50 100 100")
          circle.sun(cx=0 cy=0 r=20)
      .dayweather
        h3 THU
        svg(viewbox=" -50 -50 100 100")
          circle.sun(cx=0 cy=0 r=20)
      .dayweather
        h3 WED
        svg(viewbox=" -50 -50 100 100")
          circle.sun(cx=0 cy=0 r=20)
          circle.cloud(cx=0 cy=30 r=20)
          circle.cloud(cx=-15 cy=30 r=20)
          circle.cloud(cx=-30 cy=30 r=20)
          circle.cloud(cx=-25 cy=10 r=15)
          circle.cloud(cx=-7 cy=15 r=15)
      .dayweather
        h3 THU
        svg(viewbox=" -50 -50 100 100")
          circle.sun(cx=0 cy=0 r=20)
          circle.cloud(cx=0 cy=30 r=20)
          circle.cloud(cx=-15 cy=30 r=20)
          circle.cloud(cx=-30 cy=30 r=20)
          circle.cloud(cx=-25 cy=10 r=15)
          circle.cloud(cx=-7 cy=15 r=15)
      .dayweather
        h3 FRI
        svg(viewbox=" -50 -50 100 100")
          circle.sun(cx=0 cy=0 r=20)
      .dayweather
        h3 SAT
        svg(viewbox=" -50 -50 100 100")
          circle.sun(cx=0 cy=0 r=20)
      .dayweather
        h3 SUN
        svg(viewbox=" -63 -20 100 100")   
          line.rain(x1=-25 y1=15 x2=-25 y2=35)
          line.rain(x1=-14 y1=5 x2=-14 y2=25)
          line.rain(x1=-5 y1=20 x2=-5 y2=45)
          circle.cloud(cx=0 cy=30 r=20)
          circle.cloud(cx=-15 cy=30 r=20)
          circle.cloud(cx=-30 cy=30 r=20)
          circle.cloud(cx=-25 cy=10 r=15)
          circle.cloud(cx=-7 cy=15 r=15)





              
            
!

CSS

              
                $color_white: #f3f3f3
$color_yellow: #FFD633
$color_black: #333
$color_blue_start: #19283D
$color_blue_end: #1D678F
$color_rain: #4DACFF
$color_white_cloud: #f2f9fe
$color_grey_cloud: #ccc



*
  // border: solid 1px black
  position: relative
  font-family: 'Hind Vadodara', sans-serif,"微軟正黑體"

@mixin size($w,$h)
  width: $w
  height: $h
  
html,body
  width: 100%
  height: 100%
  margin: 0
  padding: 0
  display: flex
  justify-content: center
  align-items: center
  background-color: $color_black
  box-shadow: 0px 0px 20px rgba(black,0.3)
  
label
  cursor: pointer
  
.daybox
  width: 50%
  max-width: 400px
  background-color: $color_white
  border-radius: 5px
  cursor: pointer
  &:hover
    .bottom
      height: 100px
    .dayweather
      opacity: 1
      top: 0px
  
.temsvg
  width: 100%
  polyline
    stroke: $color_white
    stroke-width: 1px
    fill: none  
    opacity: 0.2
  text
    fill: $color_white
    transform: translateX(-5px) translateY(20px)
    font-size: 12px
    opacity: 0
  circle
    fill: $color_white
    opacity: 0.2
.rain 
  +size(2px,10px)
  position: absolute
  left: 45px
  bottom: 15px
  animation: raindrop 1s infinite linear
  background-color: $color_white
.rain2
  left: 70px
  bottom: 20px
  animation-delay: -0.4s
.rain3
  left: 30px
  bottom: 20px
  animation-delay: -0.7s

@keyframes raindrop
  0%
    transform: translateY(0px)
  100%
    transform: translateY(50px)
    opacity: 0
.top
  height: 330px
  background: linear-gradient(20deg,$color_blue_start,$color_blue_end)
  background-size: 100% 300%
  animation: daylight 20S both
  border-radius: 5px 5px 0px 0px
  
  
  @keyframes daylight
    0%
      background-position: 100% 30%
    100%
      background-position: 100% 100%
  
  
 
  .moon
    +size(50px,50px)
    border-radius: 100%
    box-shadow: 15px -15px
    position: absolute
    left: 50px
    top: 100px
    animation: moonmove 20s infinite
    
    
  @keyframes moonmove
    0%
      box-shadow: 15px -15 $color_yellow
      transform: translateX(-15px) translateY(15px)
    100%
       box-shadow: -30px 30px $color_yellow
       transform: translateX(30px) translateY(-30px)
    
    
    
    
.cloud
  +size(100px,36px)
  position: absolute
  left: 200px
  bottom: 50px
  border-radius: 20px
  animation: clouddrift 4s infinite 
  background-color: $color_white
  box-shadow: 0px 0px 20px rgba(black,5)
  &:before,&:after
    content: ""
    // border: solid 1px
    display: block
    +size(50px,50px)
    border-radius: 100px
    position: absolute
    background-color: $color_white
  
  &:before
    left: 16px
    top: -28px
  &:after
    left: 35px
    top: -20px

@keyframes clouddrift
  0%
   transform: translateY(0px) 
  50%
    transform: translateY(-20px) 
  100%
    transform: translateY(0px) 

.bottom
  height: 10px
  display: flex
  justify-content: center
  box-shadow: 0px 0px 20px rgba(black,0.5)
  border-radius: 0px 0px 5px 5px 
  overflow: hidden
  transition-duration: 1s
  background-color: #FFF5EE
  
  .dayweather
    width: calc(100% / 7 - 5px)
    display: inline-block
    text-align: center
    opacity: 0
    top: 20px
    transition: 0.5s
    
    h3
      font-size: 8px
      letter-spacing:1px
    svg
      width: 100%
      max-width: 40px
      height: 30px
      .sun 
        fill: $color_yellow
        stroke: rgba($color_yellow,0.5)
        stroke-width: 30px
        stroke-dasharray: 5px
      .rain
        stroke: $color_rain
        
      .cloud
        fill: $color_grey_cloud
        
.dayweather:nth-child(1)
  transition-delay: 0.2s
.dayweather:nth-child(2)
  transition-delay: 0.4s
.dayweather:nth-child(3)
  transition-delay: 0.6s
.dayweather:nth-child(4)
  transition-delay: 0.8s
.dayweather:nth-child(5)
  transition-delay: 1s
.dayweather:nth-child(6)
  transition-delay: 1.2s
.dayweather:nth-child(7)
  transition-delay: 1.4s
        
    
    
.text_area
  display: inline-block
  position: absolute
  bottom: 25px
  left: 25px
  color: $color_white
  
  
  & .temperature
      font-size: 75px
      line-height: 70px
  & .infos
      font-size: 13px
      opacity: 0.5

      
.moon,.cloud
  transition: 0.5s
.temsvg
  circle,polyline,text
    transition: 0.5s
  polyline
    transition: 0.5s 0.5s
  text 
    transition: 0.5s 1s

#switch_night
  display: none
      
#switch_night:checked+.top
  .moon,.cloud
    opacity: 0.3
  .temsvg
    circle,polyline,text
      opacity: 1
      
    
  
              
            
!

JS

              
                // sass顏色們:

// $color_white: #f3f3f3

// $color_yellow: #FFD633

// $color_black: #333

// $color_blue_start: #19283D

// $color_blue_end: #1D678F

// $color_rain: #4DACFF

// $color_white_cloud: #f2f9fe

// $color_grey_cloud: #ccc
              
            
!
999px

Console