JSFiddle - React, Tailwind, and code Playground

by andi msc

HTML

<ul>
		<li>
			<a href="#" title="Sunrise">
				<img src="http://www.thecssninja.com/demo/css_hover2/img_sunrise.jpg" width="150" height="100" alt="Beautiful sunrise">
			</a>
		</li>
		
		<li>
			<a href="#" class="reverse" title="A waterfall">
				<img src="http://www.thecssninja.com/demo/css_hover2/img_waterfall.jpg" width="100" height="150" alt="Waterfall">
			</a>
		</li>
		
		<li>
			<a href="#" class="offset" title="Sunset">
				<img src="http://www.thecssninja.com/demo/css_hover2/img_sunset.jpg" width="150" height="113" alt="Majestic sunset">
			</a>
		</li>
	</ul>

CSS

ul { overflow: hidden; padding: 5px; }
ul > li {
	position: relative;
	float: left;
	list-style: none;
	margin: 0 20px 20px 0;
	font-size: 10px;
	z-index: 1;
}
ul a 							{ text-decoration: none; display: block; }
ul li img 						{ display: block; position: relative; z-index: -1; } /* IE8 fix, background colour appears behind img for uknown reason set negative z-index */
ul li:not([class=na]) img 		{ position: static; } /* Reset relative position, as this plays havoc with good browsers */
ul a:hover, ul a:focus			{ display: block; outline: none; -moz-box-shadow: 3px 3px 5px #000; -webkit-box-shadow: 3px 3px 5px #000; box-shadow: 3px 3px 5px #000; }
ul a:hover img, ul a:focus img	{ outline: 3px solid #ccc; }

ul a:hover:after,
ul a:focus:after
{
	content: attr(title);
	color: #000;
	position: absolute;
	bottom: 0;
	height: 30px;
	line-height: 30px;
	text-align: center;
	font-weight: bold;
	width: 100%;
	background: rgb(255,255,255);
	background: rgba(255,255,255,0.7);
	background: -moz-linear-gradient(top, rgba(255,255,255,0.7), rgba(204,204,204,0.7)); /* Firefox 3.6+ */
	background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(255,255,255,0.7)), to(rgba(204,204,204,0.7))); /* Safari */
	display: block;
	text-shadow: 1px 1px 1px #fff;
}
ul a.reverse:hover:after,
ul a.reverse:focus:after { top: 0; right: 0; }

ul a.offset:hover:after,
ul a.offset:focus:after { top: 50%; margin-top: -15px; }

ul a.alternate01:hover:after,
ul a.alternate01:focus:after
{ 
	top: 0;
	width: 50%; 
	height: 100%; 
	line-height: normal; 
	text-align: left; 
	padding: 4px; 
	font-size: 12px;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
}

/* Change colours */
ul.highlight01 a:hover img, ul.highlight01 a:focus img { outline-color: #1E528C; }

ul.highlight01 a:hover:after,
ul.highlight01 a:focus:after
{
	background: rgb(30,82,140); 
	background: rgba(30, 82, 140, 0.7);
	background: -moz-linear-gradient(top, rgba(30, 82, 140, 0.7), rgba(43,...