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.

            
              <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