Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <div class="system-container" id="gbasp">
	<div class="screen-body">
		<div class="screen-bumper" id="bumper-ul"></div>
			<div class="screen-bumper" id="bumper-ur"></div>
			<div class="screen-bumper small-bumper" id="bumper-tm"></div>
			<div class="screen-bumper small-bumper" id="bumper-ll"></div>
			<div class="screen-bumper small-bumper" id="bumper-lr"></div>
			<div class="screen-border">
				<div class="screen"><iframe width="560" height="315" src="https://www.youtube.com/embed/YFKusOerZDA?autoplay=0" frameborder="0"></iframe></div>
				<img src="https://upload.wikimedia.org/wikipedia/commons/0/0d/Gameboy_advance_SP_logo.svg">
				</div>
	</div>
	<div class="swivel"> </div>
	
	<div class="gamepad-body">
	
		<div class="power-light"></div>
		<div class="power-light"></div>

		
			<div class="pad-container dpad-container">
				<div class="d-pad"></div>
			</div>
				
			<div class="pad-container buttons-container"> 
				<div class="b-button">
					<span class="letter">B</span>
				</div>
				
				<a href="#"><div class="a-button">
					<span class="letter">A</span>
				</div></a>
				
			</div>
				
			<div class="pad-container power-container">
				<a href="#"><div class="b-button power-button"> 
					</div></a>
			</div>
				<div class="speaker-holder">
					<div class="dot small-dot"></div>
					<div class="dot small-dot"></div>
					<div class="dot small-dot"></div>
					<div class="dot small-dot"></div>
					<div class="dot small-dot"></div>
					<div class="dot large-dot"></div>
					<div class="dot large-dot"></div>
					<div class="dot small-dot"></div>
					<div class="dot small-dot"></div>
					<div class="dot large-dot"></div>
					<div class="dot large-dot"></div>
					<div class="dot small-dot"></div>
					<div class="dot small-dot"></div>
					<div class="dot small-dot"></div>
					<div class="dot small-dot"></div>
					<div class="dot small-dot"></div>
		</div>
			
		
		<div class="pad-container select-container">
			<div class="a-button select-button"> </div>
			</div>

		<div class="pad-container start-container">
				<div class="a-button start-button"> 
			</div>
			</div>
		
		<div class="select-label">SELECT</div>
		<div class="select-label">SELECT</div>

		<div class="start-label">START</div>
		<div class="start-label">START</div>
<This is not a valid tag>

	</div>
</div>
              
            
!

CSS

              
                /* Adjust this to change the size of the whole pen */
$everything: 2vw;

$cobalt: #2222ff;
$darkgrey: #333;
$lightgrey: #777788;

html {
	font-size: $everything;
}

body {
	margin: 0;
	padding: 0;
	background: #ffffff;
	background: -moz-linear-gradient(top, #ffffff 0%, #C9C9C9 100%);
	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#e5e5e5));
	background: -webkit-linear-gradient(top, #ffffff 0%,#C9C9C9 100%); 
	background: -o-linear-gradient(top, #ffffff 0%,#C9C9C9 100%);
	background: -ms-linear-gradient(top, #ffffff 0%,#C9C9C9 100%);
	background: linear-gradient(to bottom, #ffffff 0%,#C9C9C9 100%);
	height: 100vh;
	width: 100%;
	display: flex;
	justify-content: center;
	align-items: center;

	.system-container#gbasp {
		width: 40.0rem;
		height: 73.0rem;
		margin: 2.0rem auto;
		z-index: 0;

		.screen-body {
				background-color: $cobalt;
				background: linear-gradient(10deg, lighten($cobalt, 5%), $cobalt, darken($cobalt, 15%));
				width: 40.0rem;
				height: 34.0rem;
				border-radius: 2.4rem;
				position: relative;
				padding: 2.0rem;
				box-sizing: border-box;
				border: .3rem solid darken($cobalt, 15%);
				border-right-color: lighten($cobalt, 20%);
				border-top-color: lighten($cobalt, 10%);
				&:before {
				content: '';
				width: 18.0rem;
				height: .8rem;
				background-color: $cobalt;
				position: absolute;
				bottom: -.8rem;
				z-index: -1;
				left: 2.0rem;
				border-right: .2rem solid lighten($cobalt, 20%);	
				-webkit-box-shadow: inset .0rem .6rem .5rem .0rem rgba(0,0,0,0.75);
				-moz-box-shadow: inset .0rem .6rem .5rem .0rem rgba(0,0,0,0.75);
				box-shadow: inset .0rem .6rem .5rem .0rem rgba(0,0,0,0.75);
				}
				&:after {
				content: '';
				width: 3.2rem;
				height: .8rem;
				background-color: $cobalt;
				position: absolute;
				bottom: -.8rem;
				z-index: -1;
				left: 32.0rem;
				border-right: .2rem solid lighten($cobalt, 20%);
				-webkit-box-shadow: inset .0rem .6rem .5rem .0rem rgba(0,0,0,0.75);
				-moz-box-shadow: inset .0rem .6rem .5rem .0rem rgba(0,0,0,0.75);
				box-shadow: inset .0rem .6rem .5rem .0rem rgba(0,0,0,0.75);
				}
		}
		.screen-border {
				background-color: $darkgrey;
				width: 100%;
				margin: 1.6rem auto;
				height: 26.8rem;
				box-sizing: border-box;
				border: .4rem solid lighten($cobalt, 30%);
				border-radius: .8rem;
				border-top-color: darken($cobalt, 25%);
				border-right-color: darken($cobalt, 15%);
				border-bottom-color: lighten($cobalt, 20%);
				img {
					position: absolute;
					left: 11.2rem;
					bottom: 4rem;
					opacity: .7;
					width: 17.5rem;
				}
		}
				.screen {
					background-color: $lightgrey;
					margin: 2.0rem auto;
					width: 90%;
					height: 21.0rem;
					iframe {
						width: 100%;
						height: 21.0rem;
					}
				}

		.screen-bumper {
		border-radius: 100%;
		width: 2.2rem;
		height: 2.2rem;
		position: absolute;
		background: radial-gradient(circle at top left, lighten($cobalt, 10%), darken($cobalt, 20%));
			border: .2rem solid darken($cobalt, 20%);
		}

		#bumper-ul {
			left: 1.0rem;
			top: .6rem;
		}

		#bumper-ur {
			right: 1.0rem;
			top: .6rem;
		}

		#bumper-ll {
			left: 1.2rem;
			bottom: .4rem
		}

		#bumper-lr {
			right: 1.2rem;
			bottom: .4rem
		}

		#bumper-tm {
			left: calc(50% - 1.0rem);
			top: .8rem;
		}

		.small-bumper {
			width: 1.6rem;
			height: 1.6rem;
			background: radial-gradient(circle at bottom left, $cobalt, darken($cobalt, 20%));
			border-width: .1rem;
			border-left-color: lighten($cobalt, 5%);
			border-bottom-color: lighten($cobalt, 5%);
		}

		.swivel {
			width: 100%;
			border-radius: 1.6rem;
			height: 4.8rem;
			background-color: $cobalt;
			position: relative;
			top: .4rem;
			-webkit-box-shadow: inset .0rem -2.0rem .8rem .0rem rgba(0,0,0,.4);
			-moz-box-shadow: inset .0rem -2.0rem .8rem .0rem rgba(0,0,0,.4);
			box-shadow: inset .0rem -2.0rem .8rem .0rem rgba(0,0,0,.4);
			border-top: .2rem solid lighten($cobalt, 5%);
					&:before {
				content: '';
				width: 18.0rem;
				height: 4.5rem;
				position: absolute;
				bottom: -2.0rem;
				z-index: 1;
				left: 2.2rem;
				top: .0rem;
				border-right: .2rem solid lighten($cobalt, 20%);	
				border-left: .2rem solid darken($cobalt, 25%);
				border-bottom: .3rem solid darken($cobalt, 50%);
				-webkit-box-shadow: inset .0rem 1.0rem .5rem .0rem rgba(255,255,255,.2);
				-moz-box-shadow: inset .0rem 1.0rem .5rem .0rem rgba(255,255,255,.2);
				box-shadow: inset .0rem 1.0rem .5rem .0rem rgba(255,255,255,.2);
				}
				&:after {
				content: '';
				width: 3.2rem;
				height: 4.5rem;
				position: absolute;
				bottom: -2.0rem;
				z-index: 1;
				left: 32.2rem;
					top: .0rem;
				border-right: .2rem solid lighten($cobalt, 20%);
				border-left: .2rem solid darken($cobalt, 20%);
				border-bottom: .3rem solid darken($cobalt, 50%);
				-webkit-box-shadow: inset .0rem 1.0rem .5rem .0rem rgba(255,255,255,.2);
				-moz-box-shadow: inset .0rem 1.0rem .5rem .0rem rgba(255,255,255,.2);
				box-shadow: inset .0rem 1.0rem .5rem .0rem rgba(255,255,255,.2);
				}
		}

		.gamepad-body {
				background-color: $cobalt;
				background: linear-gradient(10deg, lighten($cobalt, 5%), $cobalt, darken($cobalt, 15%));
				width: 40.0rem;
				height: 36.0rem;
				border-radius: 2.4rem;
				position: relative;
				padding: 2.0rem;
				box-sizing: border-box;
				border: .3rem solid darken($cobalt, 15%);
				border-right-color: lighten($cobalt, 20%);
				border-top-color: lighten($cobalt, 10%);
				z-index: -1;
				top: -2.8rem;
		}

		.pad-container {
			width: 11.0rem;
			height: 11.0rem;
			border: none;
			border-radius: 100%;
			position: absolute;
			left: 2.0rem;
			top: 10.0rem;
			&:before {
				content: '';
				z-index: 0;
				top: .4rem;
				left: .4rem;
				height: inherit;
				width: inherit;
				background: $cobalt;
				position: absolute;
				border-radius: inherit;
			}
			&:after {
				content: '';
				position: absolute;
				z-index: -1;
				top: -.4rem;
				left: -.4rem;
				width: inherit;
				height: inherit;
				background: linear-gradient(to right, lighten($cobalt, 10%), darken($cobalt, 30%));
				border-radius: inherit;
			}
		}
		
		.dpad-container {
				border: none;
				background: $cobalt;
				z-index: 99;
				&:before {
					width: 11.8rem;
					height: 11.8rem;
					border-radius: 100%;
					background: linear-gradient(to right, lighten($cobalt, 10%), darken($cobalt, 30%));
					content: '';
					position: absolute;
					top: -.4rem;
					left: -.4rem;
					z-index: -1;
				}
				&:after {
					width: 10.2rem;
					height: 10.2rem;
					border-radius: 100%;
					background: $cobalt;
					content: '';
					position: absolute;
					top: .4rem;
					left: .4rem;
					z-index: -1;
				}
		}

		.d-pad {
			width: 2.8rem;
			height: 8.4rem;
			background-color: $darkgrey;
			position: relative;
			margin: 1.2rem auto;
			box-sizing: border-box;
			border: .2rem solid darken($darkgrey, 20%);
			border-top: .2rem solid lighten($darkgrey, 20%);
			border-right: .2rem solid lighten($darkgrey, 20%);
			&:before {
				width: 3.1rem;
				height: 2.8rem;
				position: absolute;
				content: '';
				background-color: $darkgrey;
				left: -3.1rem;
				top: 2.6rem;
				border-bottom: .2rem solid darken($darkgrey, 20%);
				border-left: .2rem solid darken($darkgrey, 20%);
				border-top: .2rem solid lighten($darkgrey, 20%);
				box-sizing: border-box;
			}
			&:after {
				width: 3.1rem;
				height: 2.8rem;
				position: absolute;
				content: '';
				background-color: $darkgrey;
				left: 2.3rem;
				top: 2.6rem;
				border-top: .2rem solid lighten($darkgrey, 20%);
				border-right: .2rem solid lighten($darkgrey, 20%);
				border-bottom: .2rem solid darken($darkgrey, 20%);
				box-sizing: border-box;
			}
		}

		.buttons-container {
			width: 12.4rem;
			height: 5.1rem;
			border: .8rem solid darken($cobalt, 20%);
			border: none!important;
			background: yellow;
			border-radius: 11.0rem;
			position: relative;
			left: 20.8rem;
			top: 10.4rem;
			border-top-color: darken($cobalt, 30%);
			border-left-color: lighten($cobalt, 10%);
			border-bottom-color: lighten($cobalt, 5%);
			transform: rotate(-12deg);
			z-index: 1;
			&:before {
				width: inherit;
				height: inherit;
				background: $cobalt;
				top: 0rem;
				left: 0rem;
				position: absolute;
				content: '';
				border-radius: 11rem;
				z-index: 0;
			}
			&:after {
				content: '';
				position: absolute;
				left: -.8rem;
				top: -.8rem;
				border-radius: 11.0rem;
				width: 14rem;
				height: 6.7rem;
				background: linear-gradient(to right, lighten($cobalt, 10%), darken($cobalt, 30%));
				z-index: -1;
			}
			.letter {
				display: block;
				position: absolute;
				z-index: 200;
				top: .05em;
				left: calc(50% - .3em);
			}
		}

		.b-button, .a-button {
			font-family: Arial, Helvetica, sans-serif;
			font-weight: 700;
			line-height: 4.0rem;
			font-size: 2.2rem;
			color: lighten($darkgrey, 5%);
			transform: rotate(12deg);
			text-align: center;
			width: 4.0rem;
			height: 4.0rem;
			background-color: $darkgrey;
			border-radius: 100%;
			position: absolute;
			left: .8rem;
			top: .5rem;
			box-sizing: border-box;
			border: none;
			&:before {
				width: inherit;
				height: inherit;
				border-radius: inherit;
				content: '';
				position: absolute;
				background: yellow;
				left: -0rem;
				top: -0rem;
				background: linear-gradient(to right, lighten($darkgrey, 10%), darken($darkgrey, 5%));
				z-index: -1;
			}
			&:after {
				width: 3.6rem;
				height: 3.6rem;
				background: $darkgrey;
				content: '';
				position: absolute;
				left: .2rem;
				top: .2rem;
				border-radius: inherit;
				z-index: 0;
			}
		}

		.a-button {
			left: 7.6rem;
		}

		.power-container {
			width: 2.0rem;
			height: 2.0rem;
			position: absolute;
			left: 18.0rem;
			top: 5.2rem;
			border-width: .5rem;
			&:after {
				width: 3.8rem;
				height: 3.8rem;
			}
			&:before {
				left: 0.5rem;
				top: 0.5rem;
			}
		}

		.power-button {
			width: 2.1rem;
			height: 2.1rem;
			position: absolute;
			left: calc(50% - 0.5rem);
			top: calc(50% - 0.5rem);
			color: #fff;
			&:after {
				width: 1.6rem;
				height: 1.6rem;
				left: .2rem;
				top: .2rem;
			}
		}

		.speaker-holder {
			width: 8.0rem;
			height: 8.0rem;
			position: absolute;
			top: 20.0rem;
			left: 15.0rem;
			display: flex;
			justify-content: space-between;
			flex-wrap: wrap;
			align-items: center;
		}

		.dot {
			width: .3rem;
			height: .3rem;
			background-color: #000;
			margin: .8rem;
			border-radius: 100%;
		}

		.large-dot {
			width: .5rem;
			height: .5rem;
			border-radius: .5rem;
		}

		.select-container, .start-container {
			width: 2.2rem;
			height: 2.2rem;
			position: absolute;
			left: 14.6rem;
			top: 30.0rem;
			&:after {
				width: 3.8rem;
				height: 3.8rem;
			}
		}

		.start-container {
			left: 19.8rem;
		}

		.select-button, .start-button {
			position: absolute;
			height: 1.8rem;
			width: 1.8rem;
			left: calc(50% - 0.45rem);
			top: calc(50% - 0.45rem);
			&:after {
				height: 1.4rem;
				width: 1.4rem;
				top: .2rem;
				left: .2rem;
			}
		}

		.a-button:active {
		background-color: lighten($darkgrey, 40%);
		}

		.select-label, .start-label {
			position: absolute;
			font-family: Impact, Charcoal, sans-serif;
			font-size: 1.2rem;
			left: 14.8rem;
			bottom: 5.6rem;
			color: darken($cobalt, 15%);
			z-index: 2;
		}

		.start-label {
			left: 20.2rem;
		}

		.start-label + .start-label {
			left: 20.1rem;
			bottom: 5.7rem;
			color: lighten($cobalt, 10%);
			z-index: 1;

		}

		.select-label + .select-label{
			color: lighten($cobalt, 10%);
			left: 14.7rem;
			bottom: 5.7rem;
			z-index: 1;
		}

		.power-light {
			position: absolute;
			width: 1.4rem;
			height: 1.2rem;
			background-color: $darkgrey;
			right: -.4rem;
			top: 5.0rem;
		}

		.power-light + .power-light {
		top: 8.0rem;
		}
	}

}

@media (min-width: 480px){
	html {
		font-size: 1.5vw;
	}
}

@media (min-width: 600px){
	html {
		font-size: 1.2vw;
	}
}

@media (min-width: 720px){
	html {
		font-size: .8vw;
	}
}

@media (min-width: 1080px){
	html {
		font-size: .5vw;
	}
}
	
@media (min-width: 1600px){
	html {
		font-size: .35vw;
	}
}
              
            
!

JS

              
                const powerBtn = document.querySelector('.power-button');
const powerLight = document.querySelector('.power-light');
const screen = document.querySelector('iframe');

screen.style.display = 'none';

powerBtn.addEventListener('click', () => {
	if(screen.style.display == 'none'){
		screen.style.display = 'block';
		powerLight.style.background = '#ffb800';
		powerLight.style.boxShadow = '0px 0px 16px #ffb800';
		setTimeout(()=>{
			document.querySelector('iframe').click();
		}, 1000)
	} else {
		screen.style.display = 'none';
		powerLight.style.background = '#333';
		powerLight.style.boxShadow = 'none';
	}
});
              
            
!
999px

Console