Professional Documents
Culture Documents
❮ Previous Next ❯
Try it Yourself »
Example
<div class="topnav">
<a class="active" href="#home">Home</a>
<a href="#news">News</a>
<a href="#contact">Contact</a>
<a href="#about">About</a>
</div>
Example
/* Add a black background color to the top navigation */
.topnav {
background-color: #333;
overflow: hidden;
}
Learn how to create full page tabs, that covers the entire browser window,
with CSS and JavaScript.
HomeNewsContactAbout
Home
Home is where the heart is..
<!DOCTYPE html>
<html>
<head>
<style>
* {box-sizing: border-box}
body, html {
height: 100%;
margin: 0;
font-family: Arial;
}
/* Style tab links */
.tablink {
background-color: #555;
color: white;
float: left;
border: none;
outline: none;
cursor: pointer;
font-size: 17px;
width: 25%;
.tablink:hover {
background-color: #777;
/* Style the tab content (and add height:100% for full page content) */
.tabcontent {
color: white;
display: none;
height: 100%;
</style>
</head>
<body>
<h3>Home</h3>
</div>
<h3>News</h3>
</div>
<h3>Contact</h3>
</div>
<h3>About</h3>
</div>
<script>
function openPage(pageName,elmnt,color) {
tabcontent = document.getElementsByClassName("tabcontent");
tabcontent[i].style.display = "none";
tablinks = document.getElementsByClassName("tablink");
tablinks[i].style.backgroundColor = "";
document.getElementById(pageName).style.display = "block";
elmnt.style.backgroundColor = color;
document.getElementById("defaultOpen").click();
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
* {box-sizing: border-box}
/* Slideshow container */
.slideshow-container {
max-width: 1000px;
position: relative;
margin: auto;
.prev, .next {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
padding: 16px;
margin-top: -22px;
color: white;
font-weight: bold;
font-size: 18px;
transition: 0.6s ease;
.next {
right: 0;
.prev:hover, .next:hover {
background-color: rgba(0,0,0,0.8);
/* Caption text */
.text {
color: #f2f2f2;
font-size: 15px;
position: absolute;
bottom: 8px;
width: 100%;
text-align: center;
.numbertext {
color: #f2f2f2;
font-size: 12px;
position: absolute;
top: 0;
/* The dots/bullets/indicators */
.dot {
cursor: pointer;
height: 15px;
width: 15px;
margin: 0 2px;
background-color: #bbb;
border-radius: 50%;
display: inline-block;
.active, .dot:hover {
background-color: #717171;
/* Fading animation */
.fade {
-webkit-animation-name: fade;
-webkit-animation-duration: 1.5s;
animation-name: fade;
animation-duration: 1.5s;
}
@-webkit-keyframes fade {
to {opacity: 1}
@keyframes fade {
to {opacity: 1}
</style>
</head>
<body>
<div class="slideshow-container">
</div>
</div>
</div>
</div>
<br>
<div style="text-align:center">
</div>
<script>
var slideIndex = 1;
showSlides(slideIndex);
function plusSlides(n) {
showSlides(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
function showSlides(n) {
var i;
slides[i].style.display = "none";
slides[slideIndex-1].style.display = "block";
</script>
</body>
</html>
WEBSITE 1
<!DOCTYPE html>
<html lang="en">
<head>
<title>Page Title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1">
<style>
*{
box-sizing: border-box;
}
/* Header/logo Title */
.header {
padding: 80px;
text-align: center;
background: #1abc9c;
color: white;
}
/* Right-aligned link */
.navbar a.right {
float: right;
}
/* Column container */
.row {
display: -ms-flexbox; /* IE10 */
display: flex;
-ms-flex-wrap: wrap; /* IE10 */
flex-wrap: wrap;
}
/* Main column */
.main {
-ms-flex: 70%; /* IE10 */
flex: 70%;
background-color: white;
padding: 20px;
}
/* Footer */
.footer {
padding: 20px;
text-align: center;
background: #ddd;
}
/* Responsive layout - when the screen is less than 700px wide, make
the two columns stack on top of each other instead of next to each
other */
@media (max-width: 700px) {
.row {
flex-direction: column;
}
}
/* Responsive layout - when the screen is less than 400px wide, make
the navigation links stack on top of each other instead of next to each
other */
@media (max-width: 400px) {
.navbar a {
float: none;
width: 100%;
}
}
</style>
</head>
<body>
<div class="header">
<h1>My Website</h1>
<p>A website created by me.</p>
</div>
<div class="navbar">
<a href="#">Link</a>
<a href="#">Link</a>
<a href="#">Link</a>
<a href="#" class="right">Link</a>
</div>
<div class="row">
<div class="side">
<h2>About Me</h2>
<h5>Photo of me:</h5>
<div class="fakeimg" style="height:200px;">Image</div>
<p>Some text about me in culpa qui officia deserunt mollit
anim..</p>
<h3>More Text</h3>
<p>Lorem ipsum dolor sit ame.</p>
<div class="fakeimg" style="height:60px;">Image</div><br>
<div class="fakeimg" style="height:60px;">Image</div><br>
<div class="fakeimg" style="height:60px;">Image</div>
</div>
<div class="main">
<h2>TITLE HEADING</h2>
<h5>Title description, Dec 7, 2017</h5>
<div class="fakeimg" style="height:200px;">Image</div>
<p>Some text..</p>
<p>Sunt in culpa qui officia deserunt mollit anim id est laborum
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco.</p>
<br>
<h2>TITLE HEADING</h2>
<h5>Title description, Sep 2, 2017</h5>
<div class="fakeimg" style="height:200px;">Image</div>
<p>Some text..</p>
<p>Sunt in culpa qui officia deserunt mollit anim id est laborum
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco.</p>
</div>
</div>
<div class="footer">
<h2>Footer</h2>
</div>
</body>
</html>
WEBSITE 2-BAND
<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1">
<link rel="stylesheet" href="/w3css/3/w3.css">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/4.6.3/css/font-awesome.min.css">
<body>
function carousel() {
var i;
var x = document.getElementsByClassName("mySlides");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
myIndex++;
if (myIndex > x.length) {myIndex = 1}
x[myIndex-1].style.display = "block";
setTimeout(carousel, 3000);
}
</script>
</body>
</html>
Create A Slideshow Gallery
Step 1) Add HTML:
Example
<!-- Container for the image gallery -->
<div class="container">
<div class="mySlides">
<div class="numbertext">2 / 6</div>
<img src="img_fjords_wide.jpg"style="width:100%">
</div>
<div class="mySlides">
<div class="numbertext">3 / 6</div>
<img src="img_mountains_wide.jpg"style="width:100%">
</div>
<div class="mySlides">
<div class="numbertext">4 / 6</div>
<img src="img_lights_wide.jpg"style="width:100%">
</div>
<div class="mySlides">
<div class="numbertext">5 / 6</div>
<img src="img_nature_wide.jpg"style="width:100%">
</div>
<div class="mySlides">
<div class="numbertext">6 / 6</div>
<img src="img_snow_wide.jpg"style="width:100%">
</div>
Style the image gallery, next and previous buttons, the caption text and the
dots:
Example
* {
box-sizing: border-box;
}
/* Position the image container (needed to position the left and right
arrows) */
.container {
position: relative;
}
.row:after {
content: "";
display: table;
clear: both;
}
.active,
.demo:hover {
opacity: 1;
}
Step 3) Add JavaScript:
Example
var slideIndex = 1;
showSlides(slideIndex);
// Next/previous controls
function plusSlides(n) {
showSlides(slideIndex += n);
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("demo");
var captionText = document.getElementById("caption");
if (n > slides.length) {slideIndex = 1}
if (n < 1) {slideIndex = slides.length}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " active";
captionText.innerHTML = dots[slideIndex-1].alt;
}
PORTFOLIO
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-
scale=1">
<style>
*{
box-sizing: border-box;
}
body {
background-color: #f1f1f1;
padding: 20px;
font-family: Arial;
}
/* Center website */
.main {
max-width: 1000px;
margin: auto;
}
h1 {
font-size: 50px;
word-break: break-all;
}
.row {
margin: 8px -16px;
}
/* Content */
.content {
background-color: white;
padding: 10px;
}
<h1>MYLOGO.COM</h1>
<hr>
<h2>PORTFOLIO</h2>
<p>Resize the browser window to see the responsive
effect.</p>
<div class="content">
<img src="/w3images/p3.jpg" alt="Bear" style="width:100%">
<h3>Some Other Work</h3>
<p>Lorem ipsum dolor sit amet, tempor prodesset eos no.
Temporibus necessitatibus sea ei, at tantas oporteat nam.
Lorem ipsum dolor sit amet, tempor prodesset eos no.</p>
<p>Lorem ipsum dolor sit amet, tempor prodesset eos no.
Temporibus necessitatibus sea ei, at tantas oporteat nam.
Lorem ipsum dolor sit amet, tempor prodesset eos no.</p>
</div>
<!-- END MAIN -->
</div>
</body>
</html>
Fullscreen Video Background
Learn how to create a full screen video background that covers the entire
browser window:
Try it Yourself »
Example
<!-- The video -->
<video autoplay muted loop id="myVideo">
<source src="rain.mp4" type="video/mp4">
</video>
Example
/* Style the video: 100% width and height to cover the entire window
*/
#myVideo {
position: fixed;
right: 0;
bottom: 0;
min-width: 100%;
min-height: 100%;
}
/* Add some content at the bottom of the video/page */
.content {
position: fixed;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
color: #f1f1f1;
width: 100%;
padding: 20px;
}
#myBtn:hover {
background: #ddd;
color: black;
}
Optionally, you can add JavaScript to pause/play the video with a click of a
button:
Example
<script>
// Get the video
var video = document.getElementById("myVideo");
// Pause and play the video, and change the button text
function myFunction() {
if (video.paused) {
video.play();
btn.innerHTML = "Pause";
} else {
video.pause();
btn.innerHTML = "Play";
}
}
</script>