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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              <div class="tiles">
	<div class="tile lightgreen">
		<a href="#">
			<h1>Tile Heading</h1>
			<p>Content in the tile.</p>
			<aside class="category green">Cat No</aside>
		</a>
	</div>
	<div class="tile lightblue">
		<a href="#">
			<h1>Tile Heading</h1>
			<p>Content in the tile.</p>
			<aside class="category blue">Cat No</aside>
		</a>
	</div>
	<div class="tile lightorange">
		<a href="#">
			<h1>Tile Heading</h1>
			<p>Content in the tile.</p>
			<aside class="category orange">Cat No</aside>
		</a>
	</div>
</div>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Roboto:300);
body{
  font-family: 'Roboto', sans-serif;
  margin: 0.4em 0;
}
/*SPECIFIC*/
.tiles .tile{
	width:200px;
	height:130px;
	margin:5px;
	float:left;
	font-size:14px;
	padding:10px;
	position:relative;
}

.tiles .tile h1{
	font-size:16px;
	text-transform:uppercase;
}

.tiles .tile a{
	display:block;
	width:100%;
	height:100%;
	color:#000;
	text-decoration:none;
}

.tiles .tile aside{
	padding:10px;
	color:#fff;
	position:absolute;
	top:0;
	right:10px;
}

.tiles .green{
	background:#316c02;
}

.tiles .lightgreen{
	background:#afbfa2;
}

.tiles .blue{
	background:#17477d;
}

.tiles .lightblue{
	background:#7e96b0;
}

.tiles .orange{
	background:#ca6d13;
}

.tiles .lightorange{
	background:#e6b17d;
}
            
          
!
            
              $(document).ready( function(){
	$(".tile").mouseenter(function(event){
		var whichCurrCol = "";
		var parentItem = event.target.closest("div");
		//make sure you are targetting the div container not the tags that are hovered within it
		var currentSideClassSpecific = $(parentItem).find("aside").attr("class").split(" ")[1];
		//aside has multiple classes - break into an array and get the second class in this example - class="category blue" gets blue
		whichCurrCol = $("." + currentSideClassSpecific).css("background");
		$("body").css("background",whichCurrCol);
	});
});
            
          
!
999px
Loading ..................

Console