cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <h1>背景グラデーション</h1>
<p class="code"></p>
<p class="colorwindow"></p>
<div id="wrap">
	<div class="inner div01">
		<!--R-->
		<div class="red">
			<P>R</P>
			<input type="range" name="range" max="255" min="0" step="1" value="0">
			<p class="suuti">0</p>
		</div>
	<!--G-->
		<div class="green">
			<P>G</P>
			<input type="range" name="range" max="255" min="0" step="1" value="0">
			<p class="suuti">0</p>
		</div>
	<!--B-->
		<div class="blue">
			<P>B</P>
			<input type="range" name="range" max="255" min="0" step="1" value="0">
			<p class="suuti">0</p>
		</div>
	<!--Alpha-->
		<div class="alpha">
			<P>A</P>
			<input type="range" name="range" max="1" min="0" step="0.01" value="1">
			<p class="suuti">1</p>
		</div>
		
	</div>
	<div class="inner div02">
		<!--R-->
		<div class="red2">
			<P>R</P>
			<input type="range" name="range" max="255" min="0" step="1" value="0">
			<p class="suuti">0</p>
		</div>
	<!--G-->
		<div class="green2">
			<P>G</P>
			<input type="range" name="range" max="255" min="0" step="1" value="0">
			<p class="suuti">0</p>
		</div>
	<!--B-->
		<div class="blue2">
			<P>B</P>
			<input type="range" name="range" max="255" min="0" step="1" value="0">
			<p class="suuti">0</p>
		</div>
	<!--Alpha-->
		<div class="alpha2">
			<P>A</P>
			<input type="range" name="range" max="1" min="0" step="0.01" value="1">
			<p class="suuti">1</p>
		</div>
	</div>
</div>
            
          
!
            
              *{
	box-sizing: border-box;
}
html{
	height:100%;
}
body{
	height:100%;
	background:#fff;
	font-family: 'arial narrow';
}
h1{
	text-align:center;
	line-height: 3;
	padding-top:20px;
	font-size: 18px;
}
#wrap{
	.inner{
		background: #fff;
		width: 100%;
		text-align:center;
		padding:20px;
		display:flex;
  	justify-content: center;
		div{
			margin:0 10px 20px;
			display:flex;
  		flex-direction:row;
			input{
				margin: 0 5px;
				width: 100px;
			}
			.suuti{
				width:2em;
			}
		}
	}
}
.code{
	background:#fff;
	width:100%;
	text-align:center;
	line-height:2;
	margin-bottom:20px;
	}
.colorwindow{
	background: rgba(255,255,255,1);
	width:400px;
	margin: 0 auto 20px;
	height:400px;
	border-radius:50%;
	box-shadow: 0 0 5px 1px #000;
}

            
          
!
            
              $(function(){
	var suutiR = $('.red input[type=range]');
	var suutiG = $('.green input[type=range]');
	var suutiB = $('.blue input[type=range]');
	var suutiA = $('.alpha input[type=range]');
	var rangevalR = 0;
	var rangevalG = 0;
	var rangevalB = 0;
	var rangevalA = 1;
	
	var suuti2R = $('.red2 input[type=range]');
	var suuti2G = $('.green2 input[type=range]');
	var suuti2B = $('.blue2 input[type=range]');
	var suuti2A = $('.alpha2 input[type=range]');
	var rangeval2R = 0;
	var rangeval2G = 0;
	var rangeval2B = 0;
	var rangeval2A = 1;
	
	valval();
	
	$('input[type=range]').on('input', function(){
		valval();
	});
	
	function valval(){
		var rangevalR = $(suutiR).val();
		var rangevalG = $(suutiG).val();
		var rangevalB = $(suutiB).val();
		var rangevalA = $(suutiA).val();
		var rangeval2R = $(suuti2R).val();
		var rangeval2G = $(suuti2G).val();
		var rangeval2B = $(suuti2B).val();
		var rangeval2A = $(suuti2A).val();
		var valcode = 'rgba( '+ rangevalR +', ' + rangevalG+', '+ rangevalB +', '+ rangevalA +')';
		var valcode2 = 'rgba( '+ rangeval2R +', ' + rangeval2G+', '+ rangeval2B +', '+ rangeval2A +')';
		var colorcode = 'linear-gradient(180deg, '+ valcode2 +' , '+ valcode+' )';
		
	$('.colorwindow').css('background-image',colorcode);
	$('.red .suuti').text(rangevalR);
	$('.green .suuti').text(rangevalG);
	$('.blue .suuti').text(rangevalB);
	$('.alpha .suuti').text(rangevalA);
	$('.red2 .suuti').text(rangeval2R);
	$('.green2 .suuti').text(rangeval2G);
	$('.blue2 .suuti').text(rangeval2B);
	$('.alpha2 .suuti').text(rangeval2A);
	$('.code').text(	'background-image:'+ colorcode +';'	);
};

});

            
          
!
999px
Loading ..................

Console