Вы находитесь на странице: 1из 4

• Full page Tabs

<button class="tablink" onclick="openPage('Home', this,

<button class="tablink" onclick="openPage('News', this, 'green')"
<button class="tablink" onclick="openPage('Contact', this,
<button class="tablink" onclick="openPage('About', this,

<div id="Home" class="tabcontent">

<p>Home is where the heart is..</p>

<div id="News" class="tabcontent">

<p>Some news this fine day!</p>

<div id="Contact" class="tabcontent">

<p>Get in touch, or swing by for a cup of coffee.</p>
<div id="About" class="tabcontent">
<p>Who we are and what we do.</p>
/* Set height of body and the document to 100% to enable "full page tabs"
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;
padding: 14px 16px;
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;
padding: 100px 20px;
height: 100%;
#Home {background-color: red;}
#News {background-color: green;}
#Contact {background-color: blue;}
#About {background-color: orange;}
• JAVA script
function openPage(pageName, elmnt, color) {
// Hide all elements with class="tabcontent" by default
var i, tabcontent, tablinks;
tabcontent =
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
// Remove the background color of all tablinks/buttons
tablinks =
for (i = 0; i < tablinks.length; i++) {
tablinks[i].style.backgroundColor = "";
// Show the specific tab content
document.getElementById(pageName).style.display =
// Add the specific color to the button used to open
the tab content
elmnt.style.backgroundColor = color;
// Get the element with id="defaultOpen" and click on it
• Html(practice pages)show answers
<button class="collapsible">Open Collapsible</button>
<div class="content">
<p>Lorem ipsum...</p>
• Css
/* Style the button that is used to open and close the
collapsible content */
.collapsible {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
/* Add a background color to the button if it is clicked on
(add the .active class with JS), and when you move the
mouse over it (hover) */
.active, .collapsible:hover {
background-color: #ccc;
/* Style the collapsible content. Note: hidden by default
.content {
padding: 0 18px;
display: none;
overflow: hidden;
background-color: #f1f1f1;