Clear CSS3 pager


Clear CSS3 pager with no images... holy magic!
All links has four statuses: regular, hover, active and "on" (current page).
The first and the last links are styled with WebSymbolsRegular.


( 1 2 3 4 5 6 )

HTML

<pager>
	<a href="javascript:void(0)">(</a>
	<a href="javascript:void(0)">1</a>
	<a href="javascript:void(0)">2</a>
	<a href="javascript:void(0)" class="on">3</a> <!-- current page -->
	<a href="javascript:void(0)">4</a>
	<a href="javascript:void(0)">5</a>
	<a href="javascript:void(0)">6</a>
	<a href="javascript:void(0)">)</a>
</pager>

JS + jQuery

$(document).ready(function(){
	links_container = 'pager';
	links = $(links_container + ' a');
	links.click(function(){
		if ($(this).attr('data-link') != '+' && $(this).attr('data-link') != '-') {
			links.removeClass('on');
			$(this).addClass('on');
		} else {
			var was_on_link = parseInt($(links_container + ' .on').html());
			var new_on_link = ($(this).attr('data-link') == '+') ? (was_on_link + 1) : (was_on_link - 1);
			if (new_on_link > 0 && new_on_link < (links.length - 1) ){
				links.removeClass('on');
				$(links_container + ' a:nth-child(' + (new_on_link+1) + ')').addClass('on');
			}
		}
	});
});

CSS

Here is our pages container css.

pager {
	position:relative; 
	display:block;
	overflow: visible;
	display: inline-block;
}

...and let the magic begin...

pager a {
	font: bold 20px/30px Tahoma, Arial;
	cursor: pointer;
	text-decoration: none;
	color: #464646;
	display: block;
	float: left;
	margin-right: 1px;
	box-shadow: 
			inset rgba(0,0,0,0.1) 0 1px 0,
			inset rgba(255,255,255,0.7) 0 2px 0, 
			inset rgba(255,255,255,0.7) 0 -1px 0, 
			inset rgba(255,255,255,0.7) 1px 0 0, 
			inset rgba(255,255,255,0.7) -1px 0 0,
			rgba(0,0,0,0.3) 0 3px 0;
	-moz-box-shadow: 
			inset rgba(0,0,0,0.1) 0 1px 0,
			inset rgba(255,255,255,0.7) 0 2px 0, 
			inset rgba(255,255,255,0.7) 0 -1px 0, 
			inset rgba(255,255,255,0.7) 1px 0 0, 
			inset rgba(255,255,255,0.7) -1px 0 0,
			rgba(0,0,0,0.3) 0 3px 0;
	-webkit-box-shadow: 
			inset rgba(0,0,0,0.1) 0 1px 0,
			inset rgba(255,255,255,0.7) 0 2px 0, 
			inset rgba(255,255,255,0.7) 0 -1px 0, 
			inset rgba(255,255,255,0.7) 1px 0 0, 
			inset rgba(255,255,255,0.7) -1px 0 0,
			rgba(0,0,0,0.3) 0 3px 0;
	padding: 2px 10px;
	min-width: 10px;
	text-align: center;
	position: relative;
	text-shadow: #fff 0 1px 0;
	background: #cdcdcd;
	background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(255,255,255,0.8)), to(rgba(200,200,200,0.9)));
	background: -webkit-linear-gradient(top, rgba(255,255,255,0.8), rgba(200,200,200,0.9));
	background:    -moz-linear-gradient(top, rgba(255,255,255,0.8), rgba(200,200,200,0.9));
	background:     -ms-linear-gradient(top, rgba(255,255,255,0.8), rgba(200,200,200,0.9));
	background:      -o-linear-gradient(top, rgba(255,255,255,0.8), rgba(200,200,200,0.9));
}

pager a:after {
	content: '';
	position: absolute;
	bottom: -3px;
	height: 100%;
	display: block;
	width: 100%;
	left: 0;
	box-shadow: inset rgba(255,255,255,0.2) 1px 0 0,  inset rgba(255,255,255,0.2) -1px 0 0, rgba(0,0,0,0.4) 0 1px 0;
	-moz-box-shadow: inset rgba(255,255,255,0.2) 1px 0 0,  inset rgba(255,255,255,0.2) -1px 0 0, rgba(0,0,0,0.4) 0 1px 0;
	-webkit-box-shadow: inset rgba(255,255,255,0.2) 1px 0 0,  inset rgba(255,255,255,0.2) -1px 0 0, rgba(0,0,0,0.4) 0 1px 0;
}

pager a:first-child::after {
	border-radius: 500px 0 0 500px;
	-moz-border-radius: 500px 0 0 500px;
	-webkit-border-radius: 500px 0 0 500px;
}

pager a:last-child::after {
	border-radius: 0 50px 50px 0;
	-moz-border-radius: 0 50px 50px 0;
	-webkit-border-radius: 0 50px 50px 0;
}

pager a.on:after {
	height: 1px;
	bottom: -1px;
}

pager a:before {
	content: '';
	position: absolute;
	top: 1px;
	height: 100%;
	box-shadow: rgba(0,0,0,0.4) 0 3px 0;
	-moz-box-shadow: rgba(0,0,0,0.4) 0 3px 0;
	-webkit-box-shadow: rgba(0,0,0,0.4) 0 3px 0;
	width: 1px;
	display: block;
	background: rgba(0,0,0,0.4);
	right: -1px;
}

pager a:last-child::before {
	display: none !important;
}

pager a:first-child {
	border-radius:50px 0 0 50px;
	-moz-border-radius:50px 0 0 50px;
	-webkit-border-radius:50px 0 0 50px;
	font-family: 'WebSymbolsRegular';
}

pager a:last-child {
	border-radius:0 50px 50px 0;
	-moz-border-radius:0 50px 50px 0;
	-webkit-border-radius:0 50px 50px 0;
	font-family: 'WebSymbolsRegular';
}

pager a:hover {
	box-shadow: 
			inset rgba(0,0,0,0.1) 0 1px 0,
			inset rgba(255,255,255,0.7) 0 2px 0, 
			inset rgba(255,255,255,0.7) 0 -1px 0, 
			inset rgba(255,255,255,0.7) 1px 0 0, 
			inset rgba(255,255,255,0.7) -1px 0 0,
			inset rgba(255,255,255,1) 0 0 15px,
			rgba(0,0,0,0.2) 0 3px 0;
	-moz-box-shadow: 
			inset rgba(0,0,0,0.1) 0 1px 0,
			inset rgba(255,255,255,0.7) 0 2px 0, 
			inset rgba(255,255,255,0.7) 0 -1px 0, 
			inset rgba(255,255,255,0.7) 1px 0 0, 
			inset rgba(255,255,255,0.7) -1px 0 0,
			inset rgba(255,255,255,1) 0 0 15px,
			rgba(0,0,0,0.2) 0 3px 0;
	-webkit-box-shadow: 
			inset rgba(0,0,0,0.1) 0 1px 0,
			inset rgba(255,255,255,0.7) 0 2px 0, 
			inset rgba(255,255,255,0.7) 0 -1px 0, 
			inset rgba(255,255,255,0.7) 1px 0 0, 
			inset rgba(255,255,255,0.7) -1px 0 0,
			inset rgba(255,255,255,1) 0 0 15px,
			rgba(0,0,0,0.2) 0 3px 0;
}

pager a:active {
	box-shadow: 
			inset rgba(0,0,0,0.1) 0 1px 0,
			inset rgba(0,0,0,0.3) 1px 0 0px, 
			inset rgba(0,0,0,0.3) -1px 0 0px,
			inset rgba(255,255,255,0.7) 0 2px 0, 
			inset rgba(255,255,255,0.7) 0 -1px 0, 
			inset rgba(0,0,0,0.1) 0 0 15px,
			rgba(0,0,0,0.2) 0 2px 0;
	-webkit-box-shadow: 
			inset rgba(0,0,0,0.1) 0 1px 0,
			inset rgba(0,0,0,0.3) 1px 0 0px, 
			inset rgba(0,0,0,0.3) -1px 0 0px,
			inset rgba(255,255,255,0.7) 0 2px 0, 
			inset rgba(255,255,255,0.7) 0 -1px 0, 
			inset rgba(0,0,0,0.1) 0 0 15px,
			rgba(0,0,0,0.2) 0 2px 0;
	-moz-box-shadow: 
			inset rgba(0,0,0,0.1) 0 1px 0,
			inset rgba(0,0,0,0.3) 1px 0 0px, 
			inset rgba(0,0,0,0.3) -1px 0 0px,
			inset rgba(255,255,255,0.7) 0 2px 0, 
			inset rgba(255,255,255,0.7) 0 -1px 0, 
			inset rgba(0,0,0,0.1) 0 0 15px,
			rgba(0,0,0,0.2) 0 2px 0;
	top: 1px;
	text-shadow: #fff 0 0 15px;
}

pager a:active:after {
	bottom:-2px;
}

pager a:active:before {
	box-shadow: rgba(0,0,0,0.4) 0 2px 0;
	-moz-box-shadow: rgba(0,0,0,0.4) 0 2px 0;
	-webkit-box-shadow: rgba(0,0,0,0.4) 0 2px 0;
	top: 0px;
}

pager a.on {
	box-shadow: 
			inset rgba(0,0,0,0.1) 0 1px 0,
			inset rgba(0,0,0,0.3) 1px 0 0px, 
			inset rgba(0,0,0,0.3) -1px 0 0px,
			inset rgba(255,255,255,0.7) 0 2px 0, 
			inset rgba(255,255,255,0.7) 0 -1px 0, 
			inset rgba(0,0,0,0.1) 0 0 15px,
			rgba(0,0,0,0.3) 0 1px 0;
	-moz-box-shadow: 
			inset rgba(0,0,0,0.1) 0 1px 0,
			inset rgba(0,0,0,0.3) 1px 0 0px, 
			inset rgba(0,0,0,0.3) -1px 0 0px,
			inset rgba(255,255,255,0.7) 0 2px 0, 
			inset rgba(255,255,255,0.7) 0 -1px 0, 
			inset rgba(0,0,0,0.1) 0 0 15px,
			rgba(0,0,0,0.3) 0 1px 0;
	-webkit-box-shadow: 
			inset rgba(0,0,0,0.1) 0 1px 0,
			inset rgba(0,0,0,0.3) 1px 0 0px, 
			inset rgba(0,0,0,0.3) -1px 0 0px,
			inset rgba(255,255,255,0.7) 0 2px 0, 
			inset rgba(255,255,255,0.7) 0 -1px 0, 
			inset rgba(0,0,0,0.1) 0 0 15px,
			rgba(0,0,0,0.3) 0 1px 0;
	top: 2px;
	text-shadow: #fff 0 0 15px;
}

pager a.on:before {
	box-shadow: rgba(0,0,0,0.4) 0 3px 0;
	-moz-box-shadow: rgba(0,0,0,0.4) 0 3px 0;
	-webkit-box-shadow: rgba(0,0,0,0.4) 0 3px 0;
	top: -1px;
}

pager a.on:active:after {
	bottom:-1px;
}

P.S. Sorry IE... and other browsers that can't read this code:)


blog comments powered by Disqus