File tree Expand file tree Collapse file tree 3 files changed +126
-0
lines changed Expand file tree Collapse file tree 3 files changed +126
-0
lines changed Original file line number Diff line number Diff line change 1+ let  sliders  =  document . querySelectorAll ( 'input[type="range"]' ) ; 
2+ let  colors  =  document . querySelectorAll ( 'input[type="color"]' ) ; 
3+ let  output  =  document . getElementById ( "css-code" ) ; 
4+ let  btnCopy  =  document . getElementById ( "copy" ) ; 
5+ 
6+ sliders . forEach ( ( slider )  =>  { 
7+   slider . addEventListener ( "input" ,  createBox ) ; 
8+ } ) ; 
9+ 
10+ colors . forEach ( ( color )  =>  { 
11+   color . addEventListener ( "change" ,  createBox ) ; 
12+ } ) ; 
13+ 
14+ btnCopy . addEventListener ( "click" ,  ( )  =>  { 
15+   output . select ( ) ; 
16+   document . execCommand ( "copy" ) ; 
17+   alert ( "Code Copied" ) ; 
18+ } ) ; 
19+ 
20+ function  createBox ( )  { 
21+   let  X  =  sliders [ 0 ] . value ; 
22+   let  Y  =  sliders [ 1 ] . value ; 
23+   let  blurRadius  =  sliders [ 2 ] . value ; 
24+   let  spreadRadius  =  sliders [ 3 ] . value ; 
25+ 
26+   let  shadowcolor  =  colors [ 0 ] . value ; 
27+   let  boxShadow  =  `${ X } ${ Y } ${ blurRadius } ${ spreadRadius }  ; 
28+ 
29+   document . getElementById ( 
30+     "box" 
31+   ) . style . cssText  =  `box-shadow: ${ boxShadow } ${ shadowcolor }  ; 
32+   output . value  =  `box-shadow: ${ boxShadow }  ; 
33+ } 
34+ 
35+ createBox ( ) ; 
Original file line number Diff line number Diff line change 1+ < html  lang ="en "> 
2+   < head > 
3+     < meta  charset ="UTF-8 " /> 
4+     < meta  http-equiv ="X-UA-Compatible " content ="IE=edge " /> 
5+     < meta  name ="viewport " content ="width=device-width, initial-scale=1.0 " /> 
6+     < title > Box Shadow Generator</ title > 
7+     < link  rel ="stylesheet " href ="style.css " /> 
8+   </ head > 
9+   < body > 
10+     < div  class ="container "> 
11+       < div  class ="wrapper "> 
12+         < div  id ="box "> </ div > 
13+ 
14+         < div  class ="sliders "> 
15+           < input  type ="range " id ="sldr1 " value ="0 " min ="-5 " max ="5 " /> 
16+           < input  type ="range " id ="sldr2 " value ="0 " min ="-5 " max ="5 " /> 
17+           < input  type ="range " id ="sldr3 " value ="10 " min ="0 " max ="10 " /> 
18+           < input  type ="range " id ="sldr4 " value ="0 " min ="0 " max ="10 " /> 
19+         </ div > 
20+ 
21+         < div  id ="outputCode "> 
22+           < input  type ="text " id ="css-code " readonly  /> 
23+           < button  id ="copy "> Copy</ button > 
24+         </ div > 
25+ 
26+         < div  class ="colors "> 
27+           < input  type ="color " id ="shadowcolor " /> 
28+         </ div > 
29+       </ div > 
30+     </ div > 
31+ 
32+     < script  src ="app.js "> </ script > 
33+   </ body > 
34+ </ html > 
Original file line number Diff line number Diff line change 1+ * 
2+   left :  0 ;
3+   top :  0 ;
4+ }
5+ 
6+ body  {
7+   display :  grid;
8+   place-items :  center;
9+ }
10+ 
11+ .container  {
12+   display :  grid;
13+   place-items :  center;
14+   background :  white;
15+   width :  98vw  ;
16+   height :  80vh  ;
17+ }
18+ 
19+ # box  {
20+   background :  # fff
21+   max-width :  80%  ;
22+   height :  20rem  ;
23+   box-shadow :  5px   10px   10px   2px   # 333
24+   margin-bottom :  10%  ;
25+   border-radius :  10px  ;
26+ }
27+ 
28+ # css-code  {
29+   width :  40%  ;
30+   padding :  10px  ;
31+   border-radius :  0 ;
32+   margin-top :  20px  ;
33+   border :  none;
34+   border-bottom :  1px   solid;
35+ }
36+ 
37+ # shadowcolor  {
38+   width :  70%  ;
39+   border :  none;
40+   margin-top :  20px  ;
41+ }
42+ 
43+ # copy  {
44+   background :  transparent;
45+   border :  none;
46+   border :  1px   solid black;
47+   padding :  10px   20px  ;
48+   cursor :  pointer;
49+   font-weight :  bold;
50+   transition :  0.5s   ease;
51+ }
52+ 
53+ # copy : hover  {
54+   background-color :  crimson;
55+   color :  # fff
56+   border :  none;
57+ }
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments