Slider

Slide 1

Content for Slide 1

Slide 2

Content for Slide 2

Slide 3

Content for Slide 3

Slide 4

Content for Slide 4

Slide 5

Content for Slide 5

HTML

							
							
<div id="slider">
	<input checked="" type="radio" name="slider" id="slide1">
	<input type="radio" name="slider" id="slide2">
	<input type="radio" name="slider" id="slide3">
	<input type="radio" name="slider" id="slide4">
	<input type="radio" name="slider" id="slide5">
	
	<div id="slides">
		<div id="overflow">
			<div class="inner">
				<div class="slide slide_1">
					<div class="slide-content">
						<h3>Slide 1</h3>
						<p>Content for Slide 1</p>
					</div>
				</div>
				<div class="slide slide_2">
					<div class="slide-content">
						<h3>Slide 2</h3>	
						<p>Content for Slide 2</p>
					</div>
				</div>
				<div class="slide slide_3">
					<div class="slide-content">
						<h3>Slide 3</h3>
						<p>Content for Slide 3</p>
					</div>
				</div>
				<div class="slide slide_4">
					<div class="slide-content">
						<h3>Slide 4</h3>
						<p>Content for Slide 4</p>
					</div>
				</div>
				<div class="slide slide_5">
					<div class="slide-content">
						<h3>Slide 5</h3>
						<p>Content for Slide 5</p>
					</div>
				</div>
			</div>
		</div>
	</div> 

	<div id="controls">
		<label for="slide1"></label>
		<label for="slide2"></label>
		<label for="slide3"></label>
		<label for="slide4"></label>
		<label for="slide5"></label>
	</div>
	
	<div id="bullets">
		<label for="slide1"></label>
		<label for="slide2"></label>
		<label for="slide3"></label>
		<label for="slide4"></label>
		<label for="slide5"></label>
	</div>
</div>
							
						

CSS

							
							
#slider {
	margin: 0 auto;
	width: 800px;
	max-width: 100%;
	text-align: center;
}

#slider input[type=radio] {
	display: none;
}

#slider label {
	cursor: pointer;
	text-decoration: none;
}

#slides {
	border-radius: 5px;
	box-shadow: 1px 1px 4px #666;
	padding: 8px;
	background: #fff;
	position: relative;
	z-index: 1;
}

#overflow {
	width: 100%;
	overflow: hidden;
}

#slide1:checked ~ #slides .inner {
	margin-left: 0;
}
#slide2:checked ~ #slides .inner {
	margin-left: -100%;
}
#slide3:checked ~ #slides .inner {
	margin-left: -200%;
}

#slide4:checked ~ #slides .inner {
	margin-left: -300%;
}

#slide5:checked ~ #slides .inner {
	margin-left: -400%;
}

#slides .inner {
	-webkit-transform: translateZ(0);
	transition: margin-left 800ms cubic-bezier(0.770, 0.000, 0.175, 1.000);
}

#slides .inner {
	width: 500%;
	line-height: 0;
	height: 200px;
}

#slides .slide {
	width: 20%;
	float: left;
	display: block;
	height: 100%;
	color: #FFFFFF;
}
#slides .slide_1 {
	background-color: #d9534f;
}
#slides .slide_2 {
	background-color: #5cb85c;
}
#slides .slide_3 {
	background-color: #5bc0de;
}
#slides .slide_4 {
	background-color: #f0ad4e;
}
#slides .slide_5 {
	background-color: #0275d8;
}

#controls {
	margin: -130px 0 0 0;
	width: 100%;
	height: 50px;
	z-index: 3;
	position: relative;
}

#controls label {
	transition: opacity 0.2s ease-out;
	display: none;
	width: 50px;
	height: 50px;
	opacity: 0.4;
}
#controls label:hover {
	opacity: 1;
}

#slide1:checked ~ #controls label:nth-child(2), 
#slide2:checked ~ #controls label:nth-child(3), 
#slide3:checked ~ #controls label:nth-child(4), 
#slide4:checked ~ #controls label:nth-child(5), 
#slide5:checked ~ #controls label:nth-child(1) {
	background: url(/assets/images/slider/next.png) no-repeat;
	float: right;
	margin: 0 -50px 0 0;
	display: block;
}

#slide1:checked ~ #controls label:nth-child(5), 
#slide2:checked ~ #controls label:nth-child(1), 
#slide3:checked ~ #controls label:nth-child(2), 
#slide4:checked ~ #controls label:nth-child(3), 
#slide5:checked ~ #controls label:nth-child(4) {
	background: url(/assets/images/slider/prev.png) no-repeat;
	float: left;
	margin: 0 0 0 -50px;
	display: block;
}

#bullets {
	margin: 100px 0 0;
	text-align: center;
}

#bullets label {
	border-radius: 5px;
	display: inline-block;
	width: 10px;
	height: 10px;
	background: #bbb;
}

#slide1:checked ~ #bullets label:nth-child(1), 
#slide2:checked ~ #bullets label:nth-child(2), 
#slide3:checked ~ #bullets label:nth-child(3), 
#slide4:checked ~ #bullets label:nth-child(4),
#slide5:checked ~ #bullets label:nth-child(5) {
	background: #333;
}
/* responsive behaviour of controls */
@media screen and (max-width: 900px) {
	#slide1:checked ~ #controls label:nth-child(5), 
	#slide2:checked ~ #controls label:nth-child(1), 
	#slide3:checked ~ #controls label:nth-child(2), 
	#slide4:checked ~ #controls label:nth-child(3), 
	#slide5:checked ~ #controls label:nth-child(4) {
		margin: 0;
	}

	#slide1:checked ~ #controls label:nth-child(2), 
	#slide2:checked ~ #controls label:nth-child(3), 
	#slide3:checked ~ #controls label:nth-child(4), 
	#slide4:checked ~ #controls label:nth-child(5), 
	#slide5:checked ~ #controls label:nth-child(1) {
		margin: 0;
	}
}
/* end of responsive behaviour of controls */