Tab content not showing up - html

I am creating tabs using CSS only. The way it works is, there are 3 radio buttons, and a label for each radio button. The tab contents are set to display: none. When a tab gets selected, then that tab contents become display: block
Since there were white spaces separating the labels (tabs) I added a div around the input/label elements and used the Flexbox technique.
Now that I added the div around the inputs/labels, the tab contents never show, they never become display: block.
How can I make the tab contents show when a tab gets selected?
Here's the relevant code:
.tab1:checked ~ .tab1,
.tab2:checked ~ .tab2,
.tab3:checked ~ .tab3 {
display: block;
}
Working, but with white space
JSFiddle
.tab {
background-color: yellow;
display: inline-block;
width: calc(100% / 3);
height: 50px;
outline: 1px green solid;
}
.tabContent,
input {
display: none;
}
.tab1:checked ~ .tab1,
.tab2:checked ~ .tab2,
.tab3:checked ~ .tab3 {
display: block;
}
<div id="overallDiv">
<input type="radio" name="tabGroup1" id="rad1" class="tab1" checked="checked" />
<label for="rad1" class="tab">Fisrt Tab</label>
<input type="radio" name="tabGroup1" id="rad2" class="tab2" />
<label for="rad2" class="tab">Second Tab</label>
<input type="radio" name="tabGroup1" id="rad3" class="tab3" />
<label for="rad3" class="tab">Third Tab</label>
<div class="tabContent tab1" id="first">
First Tab
</div>
<div class="tabContent tab2" id="second">
Second Tab
</div>
<div class="tabContent tab3" id="third">
Third Tab
</div>
</div>
Not Working, but now white spaces
JSFiddle
.tab {
background-color: yellow;
display: inline-block;
width: calc(100% / 3);
height: 50px;
outline: 1px green solid;
}
.tabContent,
input {
display: none;
}
.tab1:checked ~ .tab1,
.tab2:checked ~ .tab2,
.tab3:checked ~ .tab3 {
display: block;
}
<div id="overallDiv">
<div id="tabWrapper" style="display: flex;">
<input type="radio" name="tabGroup1" id="rad1" class="tab1" checked="checked" />
<label for="rad1" class="tab">Fisrt Tab</label>
<input type="radio" name="tabGroup1" id="rad2" class="tab2" />
<label for="rad2" class="tab">Second Tab</label>
<input type="radio" name="tabGroup1" id="rad3" class="tab3" />
<label for="rad3" class="tab">Third Tab</label>
</div>
<div class="tabContent tab1" id="first">
First Tab
</div>
<div class="tabContent tab2" id="second">
Second Tab
</div>
<div class="tabContent tab3" id="third">
Third Tab
</div>
</div>

As inline element have a space margin, your div becomes a little bigger than 33% and therefore doesn't fit in 1 row.
To your Working, but with white space sample I added margin-right: -4px; re-ordered your html a little to take that space out, but this can be done using other hacks, floats and flex. (for floats/flex, see below)
The trick in this case is to make the inline elements stop and start tag to be on the same line like this: </label><label
Note: These margin space issues has already been solved before
How to remove the space between inline-block elements?
Why is there an unexplainable gap between these inline-block div elements?
.tab {
background-color: yellow;
display: inline-block;
width: calc(100% / 3);
height: 50px;
outline: 1px green solid;
}
.tabContent,
input {
display: none;
}
.tab1:checked ~ .tab1,
.tab2:checked ~ .tab2,
.tab3:checked ~ .tab3 {
display: block;
}
<div id="overallDiv">
<input type="radio" name="tabGroup1" id="rad1" class="tab1" checked="checked" />
<input type="radio" name="tabGroup1" id="rad2" class="tab2" />
<input type="radio" name="tabGroup1" id="rad3" class="tab3" />
<label for="rad1" class="tab">First Tab
</label><label for="rad2" class="tab">Second Tab
</label><label for="rad3" class="tab">Third Tab
</label>
<div class="tabContent tab1" id="first">
First Tab
</div>
<div class="tabContent tab2" id="second">
Second Tab
</div>
<div class="tabContent tab3" id="third">
Third Tab
</div>
</div>
As requested a flex version.
#overallDiv {
display: flex;
flex-wrap: wrap;
}
.tab {
background-color: yellow;
width: calc(100% / 3);
height: 50px;
outline: 1px green solid;
}
.tabContent,
input {
display: none;
}
.tabContent {
width: 100%;
}
.tab1:checked ~ .tab1,
.tab2:checked ~ .tab2,
.tab3:checked ~ .tab3 {
display: block;
}
<div id="overallDiv">
<input type="radio" name="tabGroup1" id="rad1" class="tab1" checked="checked" />
<label for="rad1" class="tab">Fisrt Tab</label>
<input type="radio" name="tabGroup1" id="rad2" class="tab2" />
<label for="rad2" class="tab">Second Tab</label>
<input type="radio" name="tabGroup1" id="rad3" class="tab3" />
<label for="rad3" class="tab">Third Tab</label>
<div class="tabContent tab1" id="first">
First Tab
</div>
<div class="tabContent tab2" id="second">
Second Tab
</div>
<div class="tabContent tab3" id="third">
Third Tab
</div>
</div>
Edit
Here is a "floats" version
#overallDiv {
clear: left;
}
.tab {
background-color: yellow;
float: left;
width: calc(100% / 3);
height: 50px;
outline: 1px green solid;
}
.tabContent,
input {
display: none;
}
.tab1:checked ~ .tab1,
.tab2:checked ~ .tab2,
.tab3:checked ~ .tab3 {
display: block;
}
<div id="overallDiv">
<input type="radio" name="tabGroup1" id="rad1" class="tab1" checked="checked" />
<label for="rad1" class="tab">First Tab</label>
<input type="radio" name="tabGroup1" id="rad2" class="tab2" />
<label for="rad2" class="tab">Second Tab</label>
<input type="radio" name="tabGroup1" id="rad3" class="tab3" />
<label for="rad3" class="tab">Third Tab</label>
<div class="tabContent tab1" id="first">
First Tab
</div>
<div class="tabContent tab2" id="second">
Second Tab
</div>
<div class="tabContent tab3" id="third">
Third Tab
</div>
</div>

There are a couple of methods to remove whitespace. Here's a good article on a couple of methods https://davidwalsh.name/remove-whitespace-inline-block. If you don't want your html to become messy you could add a font-size of 0 to the parent element, then if you have text in the child elements add a font-size to them. Your CSS would look like this:
parent element:
#overallDiv {
font-size: 0;
}
child elements:
.tabs {
font-size: 14px;
}
Here's a jsfiddle.

Related

Toggle div content after a radio button is checked using CSS only

It is work when the radio buttons are same div level with "content1" and "content2",
How to make it work, if I put radio button to another div that outside the div "second"
suppose that the toggle1 is checked then content1 will show up
(using CSS and HTML ONLY, no javascript)
.content1 {
display: none;
}
.content2 {
display: none;
}
.toggle1:checked ~ .grid-container .content1 {
display: block;
}
.toggle2:checked ~ .grid-container .content2 {
display: block;
}
<div class="level1">
<div class="level2">
<input type=radio id="toggle1" name="toggle" class="toggle1">
<label for="toggle1">toggle1</label>
<input type=radio id="toggle2" name="toggle" class="toggle2">
<label for="toggle2">toggle2</label>
<div>
<div>
<div class="second">
<div class="tab content1">Content1</div>
<div class="tab content2">Content2</div>
</div>
When using the general sibling combinator ~, the two elements must be "children of the same parent element." Given your existing code, apply the "grid-container" class to the <div> that is a sibling of the <input> elements.
.content1,
.content2 {
display: none;
}
.toggle1:checked ~ .grid-container .content1,
.toggle2:checked ~ .grid-container .content2 {
display: block;
}
<div class="level1">
<div class="level2">
<input type=radio id="toggle1" name="toggle" class="toggle1">
<label for="toggle1">toggle1</label>
<input type=radio id="toggle2" name="toggle" class="toggle2">
<label for="toggle2">toggle2</label>
<div class="grid-container">
<div>
<div class="second">
<div class="tab content1">Content1</div>
<div class="tab content2">Content2</div>
</div>
</div>
</div>
</div>
</div>

How do I have focus effect on normal elements?

I am using CSS grid to display some tabular data as shown in example
https://codepen.io/shyamforflex/pen/qBrLQeq
On row selection , the selected row should have a background color.
In current example the background red color is disappearing on mouse click release
&-row:active {
background-color: red;
}
You could use a radio button hack. Add a hidden radio button to each row. Change your "cells" to label associated with the radio button then use type=[radio]:checked ~ label to apply the styling. While the HTML is perfectly valid, the use of input here is semantically questionable at best.
From your pen you would want something like
PUG
each episode in episodes
.grid-table-row
input(type="radio" name="tbl" id=episode.series +"|"+episode.no)
label.grid-table-cell(data-title="Title" for=episode.series +"|"+episode.no)= episode.title
label.grid-table-cell(data-title="Number" for=episode.series +"|"+episode.no)= episode.no
label.grid-table-cell(data-title="Series" for=episode.series +"|"+episode.no)=episode.series
label.grid-table-cell(data-title="Air Date" for=episode.series +"|"+episode.no)= episode.airdate
SCSS
.grid-table {
display: grid;
/*Additional code removed for brevity*/
input[type=radio] {display:none}
input:checked ~ label {
background-color: red;
}
}
Compiled Demo:
h1 {
text-align: center;
}
input[type=radio] {
display: none;
}
.grid-table {
display: grid;
}
.grid-table-row {
display: grid;
grid-template-columns: repeat(2, 2fr) repeat(2, 1fr);
border-bottom: 1px solid #ddd;
}
.grid-table-row:first-child {
background: rgba(0, 0, 0, 0.5);
font-weight: bold;
}
.grid-table-row:hover {
background-color: yellow;
cursor: pointer;
}
.grid-table input:checked~label {
background-color: red;
}
.grid-table-row:nth-child(even) {
background-color: #e5e4e2;
}
.grid-table-cell {
padding: 1rem;
}
.grid-table-cell:not(:last-child) {
border-right: 1px solid #ddd;
}
<h1>Random Dr Who Tabular Data With CSS Grid</h1>
<div class="grid-table">
<div class="grid-table-row">
<div class="grid-table-cell">Title</div>
<div class="grid-table-cell">Episode Number</div>
<div class="grid-table-cell">Series</div>
<div class="grid-table-cell">Air Date</div>
</div>
<div class="grid-table-row">
<input type="radio" name="tbl" id="7|239" />
<label class="grid-table-cell" data-title="Title" for="7|239">The Name of the Doctor</label>
<label class="grid-table-cell" data-title="Number" for="7|239">239</label>
<label class="grid-table-cell" data-title="Series" for="7|239">7</label>
<label class="grid-table-cell" data-title="Air Date" for="7|239">05/18/2013</label>
</div>
<div class="grid-table-row">
<input type="radio" name="tbl" id="Special|1" />
<label class="grid-table-cell" data-title="Title" for="Special|1">The Day of the Doctor</label>
<label class="grid-table-cell" data-title="Number" for="Special|1">1</label>
<label class="grid-table-cell" data-title="Series" for="Special|1">Special</label>
<label class="grid-table-cell" data-title="Air Date" for="Special|1">11/23/2013</label>
</div>
<div class="grid-table-row">
<input type="radio" name="tbl" id="Special|2" />
<label class="grid-table-cell" data-title="Title" for="Special|2">The Time of the Doctor</label>
<label class="grid-table-cell" data-title="Number" for="Special|2">2</label>
<label class="grid-table-cell" data-title="Series" for="Special|2">Special</label>
<label class="grid-table-cell" data-title="Air Date" for="Special|2">11/25/2013</label>
</div>
<div class="grid-table-row">
<input type="radio" name="tbl" id="Special|3" />
<label class="grid-table-cell" data-title="Title" for="Special|3">The Salary of the Doctor</label>
<label class="grid-table-cell" data-title="Number" for="Special|3">3</label>
<label class="grid-table-cell" data-title="Series" for="Special|3">Special</label>
<label class="grid-table-cell" data-title="Air Date" for="Special|3">6/25/2015</label>
</div>
</div>
:focus can work for what you want to achieve only if the element is an focusable element such as anchor link or inputs. Please refer to the MDN for more information.
Solution
There is a way to add focusability to normal elements. Set tabindex to each row so that the elements become focusable.
Set tabindex to .grid-table-row
each episode in episodes
.grid-table-row(tabindex="0")
Replace &-row:active with below
&-row:focus {
background-color: red;
}
However, this method should only be used for web accessbility, which means only the interactive elements should be focusable.

Multiple tabs on a page - HTML CSS

I have the following code: Link
The problem is that the tabs are not active at the same time, when one is
active the other is disabled and I do not know how to make it work. I have
only used HTML and CSS
What I want is that both are active in tab 1 and that we keep active even
though we have the different tabs because my idea is to add more div with
tabs. I leave a link to CodePen and also insert the code here.
.tabs {
display: flex;
flex-wrap: wrap;
}
.tabs label {
order: 1;
display: block;
padding: 1rem 2rem;
cursor: pointer;
background: #90CAF9;
font-weight: bold;
transition: background ease 0.2s;
}
.tabs .tab {
order: 99;
flex-grow: 1;
width: 100%;
display: none;
padding: 1rem;
background: #fff;
}
.tabs input[type="radio"] {
display: none;
}
.tabs input[type="radio"]:checked + label {
background: #fff;
}
.tabs input[type="radio"]:checked + label + .tab {
display: block;
}
<div class="tabs">
<input type="radio" name="tab" id="tabone" checked="checked">
<label for="tabone">Tab One</label>
<div class="tab">
<h1>Tab One Content</h1>
</div>
<input type="radio" name="tab" id="tabtwo">
<label for="tabtwo">Tab Two</label>
<div class="tab">
<h1>Tab Two Content</h1>
</div>
<input type="radio" name="tab" id="tabthree">
<label for="tabthree">Tab Three</label>
<div class="tab">
<h1>Tab Three Content</h1>
</div>
</div>
<br><br><br>
<div class="tabs">
<input type="radio" name="tab" id="tabfour" checked="checked">
<label for="tabfour">Tab One</label>
<div class="tab">
<h1>Tab One Content</h1>
</div>
<input type="radio" name="tab" id="tabfive">
<label for="tabfive">Tab Two</label>
<div class="tab">
<h1>Tab Two Content</h1>
</div>
<input type="radio" name="tab" id="tabsix">
<label for="tabsix">Tab Three</label>
<div class="tab">
<h1>Tab Three Content</h1>
</div>
</div>
<div class="tabs">
<input type="radio" name="tab2" id="tabfour" checked="checked">
<label for="tabfour">Tab One</label>
<div class="tab">
<h1>Tab One Content</h1>
</div>
<input type="radio" name="tab2" id="tabfive">
<label for="tabfive">Tab Two</label>
<div class="tab">
<h1>Tab Two Content</h1>
</div>
<input type="radio" name="tab2" id="tabsix">
<label for="tabsix">Tab Three</label>
<div class="tab">
<h1>Tab Three Content</h1>
</div>
</div>
For the second section, add a different value to the name attribute for each set of radio buttons. What you were doing before was adding checked to two buttons in the same set of radio buttons.
Not 100% sure I understand the question, but it seems to me that you just need to use a different value for the name attribute in each separate tabset.
It seems you want to make many tab groups work (one is open others are close) independently from each other.
Add a different value of name attribute for each set of tabs such that each set will work as a unit where if one is opened other tabs would be closed.
In the example you have given, all the radios along the side of tab inside the first tab could have value of name attribute as tab1 and other radios under second tab-group could have tab2.
PS: radio button's name attribute allows only one of same name radio buttons to be checked.
Here is the full solution working with two panels.
.tabs {
display: flex;
flex-wrap: wrap;
}
.tabs label {
order: 1;
display: block;
padding: 1rem 2rem;
cursor: pointer;
background: #90CAF9;
font-weight: bold;
transition: background ease 0.2s;
}
.tabs [class^="tab"] {
order: 99;
flex-grow: 1;
width: 100%;
display: none;
padding: 1rem;
background: #fff;
}
.tabs input[type="radio"] {
display: none;
}
.tabs input[type="radio"]:checked + label {
background: #fff;
}
.tabs input[type="radio"]:checked + label + [class^="tab"] {
display: block;
}
<div class="tabs">
<input type="radio" name="tab" id="tabone" checked="checked">
<label for="tabone">Tab One</label>
<div class="tab">
<h1>Tab One Content (1)</h1>
</div>
<input type="radio" name="tab" id="tabtwo">
<label for="tabtwo">Tab Two</label>
<div class="tab">
<h1>Tab Two Content (1)</h1>
</div>
<input type="radio" name="tab" id="tabthree">
<label for="tabthree">Tab Three</label>
<div class="tab">
<h1>Tab Three Content (1)</h1>
</div>
</div>
<div class="tabs">
<input type="radio" name="tab2" id="tabfour" checked="checked">
<label for="tabfour">Tab One</label>
<div class="tab2">
<h1>Tab One Content (2)</h1>
</div>
<input type="radio" name="tab2" id="tabfive">
<label for="tabfive">Tab Two</label>
<div class="tab2">
<h1>Tab Two Content (2)</h1>
</div>
<input type="radio" name="tab2" id="tabsix">
<label for="tabsix">Tab Three</label>
<div class="tab2">
<h1>Tab Three Content (2)</h1>
</div>
</div>

Hide/Reveal using a checkbox

I'm trying to do what I thought would be a fairly simple, hide/reveal. If the box is checked, the text shows, if not it is hidden. I just can't seem to get it to work. I appreciate any insight. Thanks
.nav-trigger:checked ~ .Nav-Wrap {
display: block;
}
.Nav-Wrap {
display: none;
}
<div id="menuButton">
<input title="Display Menu" type="checkbox" name="displayMenu" value="yes" id="nav-trigger" class="nav-trigger" />
<label title="Display Menu" for="nav-trigger"></label>
</div>
<p class="Nav-Wrap">Test</p>
Your selector .nav-trigger:checked ~ .Nav-Wrap is not matching your current markup.
Try to place the p within the div, this should do the trick
.nav-trigger:checked ~ .Nav-Wrap {
display: block;
}
.Nav-Wrap {
display: none;
}
<div id="menuButton">
<input title="Display Menu" type="checkbox" name="displayMenu" value="yes" id="nav-trigger" class="nav-trigger" />
<label title="Display Menu" for="nav-trigger"></label>
<p class="Nav-Wrap">Test</p>
</div>

Can't Select Another Radio Button When One Is Selected

I'm using radio buttons to hack CSS-only tabs, but recently I've had a problem where when one radio button is selected, none of the others can be. When I hover over the label, it doesn't even change background color, like I specified in CSS.
Here's the relevant code:
<style>
.content-wrap{
display: none;
position: absolute;
top: 80px;
left: 0;
width: 100%;
height: calc(100% - 80px);
overflow-y: auto;
}
#main-wrap label{
display: block;
width: 48px;
height: 48px;
}
#main-wrap input[type=radio]{
}
#main-wrap [id^="tab"]:checked + label {
background-color: #404040;
}
#tab1:checked ~ #content-history,
#tab2:checked ~ #content-outline,
#tab3:checked ~ #content-edit,
#tab4:checked ~ #content-revise {
display: block;
}
</style>
<div id='main-wrap'>
<input type='radio' name='main-wrap' id='tab1' value=''><label for='tab1' class='metro-icon'>
<img src="https://maxcdn.icons8.com/windows10/PNG/64/Time_And_Date/hourglass-64.png" title="Hourglass" width="24">
</label>
<input type='radio' name='main-wrap' id='tab2' value=''>
<label for='tab2' class='metro-icon'><img src="https://maxcdn.icons8.com/windows10/PNG/64/Programming/outline-64.png" title="Outline" width="24">
</label>
<input type='radio' name='main-wrap' id='tab3' value=''>
<label for='tab3' class='metro-icon'><img src="https://maxcdn.icons8.com/windows10/PNG/64/Editing/pencil_tip-64.png" title="Pencil Tip" width="24">
</label>
<input type='radio' name='main-wrap' id='tab4' value=''>
<label for='tab4' class='metro-icon'><img src="https://maxcdn.icons8.com/windows10/PNG/64/Files/edit_file-64.png" title="Edit File" width="24">
</label>
<div class='content-wrap' id='content-history'>
<div class='main'>
<p>This is the history tab!</p>
</div>
</div>
<div class='content-wrap' id='content-outline'>
<div class='main'>
<p>This is the outline tab!</p>
</div>
</div>
<div class='content-wrap' id='content-edit'>
<div class='main'>
<div contenteditable id='main-input'>This is the edit tab!</div>
</div>
</div>
<div class='content-wrap' id='content-revise'>
<div class='main'>
<p>This is the revise tab!</p>
</div>
</div>
</div>
What am I missing?
Use this css:
#main-wrap input[type=radio]{
position:relative;
z-index:999;
}
The problem is that your .content-wrap is above the rest of radio buttons so you cannot press them.
Just remove height: calc(100% - 80px); and you will be able to mark the rest of radio buttons.
Also, change the left property because if not you are displaying the text above the second radio button so it will never be checked.
.content-wrap{
display: none;
position: absolute;
top: 80px;
left: 100px;
width: 100%;
overflow-y: auto;
}
#main-wrap label{
display: block;
width: 48px;
height: 48px;
}
#main-wrap input[type=radio]{
}
#main-wrap [id^="tab"]:checked + label {
background-color: #404040;
}
#tab1:checked ~ #content-history,
#tab2:checked ~ #content-outline,
#tab3:checked ~ #content-edit,
#tab4:checked ~ #content-revise {
display: block;
}
<div id='main-wrap'>
<input type='radio' name='main-wrap' id='tab1' value=''><label for='tab1' class='metro-icon'>
<img src="https://maxcdn.icons8.com/windows10/PNG/64/Time_And_Date/hourglass-64.png" title="Hourglass" width="24">
</label>
<input type='radio' name='main-wrap' id='tab2' value=''>
<label for='tab2' class='metro-icon'><img src="https://maxcdn.icons8.com/windows10/PNG/64/Programming/outline-64.png" title="Outline" width="24">
</label>
<input type='radio' name='main-wrap' id='tab3' value=''>
<label for='tab3' class='metro-icon'><img src="https://maxcdn.icons8.com/windows10/PNG/64/Editing/pencil_tip-64.png" title="Pencil Tip" width="24">
</label>
<input type='radio' name='main-wrap' id='tab4' value=''>
<label for='tab4' class='metro-icon'><img src="https://maxcdn.icons8.com/windows10/PNG/64/Files/edit_file-64.png" title="Edit File" width="24">
</label>
<div class='content-wrap' id='content-history'>
<div class='main'>
<p>This is the history tab!</p>
</div>
</div>
<div class='content-wrap' id='content-outline'>
<div class='main'>
<p>This is the outline tab!</p>
</div>
</div>
<div class='content-wrap' id='content-edit'>
<div class='main'>
<div contenteditable id='main-input'>This is the edit tab!</div>
</div>
</div>
<div class='content-wrap' id='content-revise'>
<div class='main'>
<p>This is the revise tab!</p>
</div>
</div>
</div>
please remove display: block from this style
#tab1:checked #content-history,
#tab2:checked ~ #content-outline,
#tab3:checked ~ #content-edit,
#tab4:checked ~ #content-revise {
display: block;
}
<style>
.content-wrap{
display: none;
position: absolute;
top: 80px;
left: 0;
width: 100%;
overflow-y: auto;
}
#main-wrap label{
display: block;
width: 40px;
height: 40px;
}
#main-wrap input[type=radio]{
}
#main-wrap [id^="tab"]:checked + label {
background-color: #404040;
}
#tab1:checked ~ #content-history,
#tab2:checked ~ #content-outline,
#tab3:checked ~ #content-edit,
#tab4:checked ~ #content-revise {
display: block;
}
</style>
<div id='main-wrap'>
<input type='radio' name='main-wrap' id='tab1' value=''><label for='tab1' class='metro-icon'>
<img src="https://maxcdn.icons8.com/windows10/PNG/64/Time_And_Date/hourglass-64.png" title="Hourglass" width="24">
</label>
<input type='radio' name='main-wrap' id='tab2' value=''>
<label for='tab2' class='metro-icon'><img src="https://maxcdn.icons8.com/windows10/PNG/64/Programming/outline-64.png" title="Outline" width="24">
</label>
<input type='radio' name='main-wrap' id='tab3' value=''>
<label for='tab3' class='metro-icon'><img src="https://maxcdn.icons8.com/windows10/PNG/64/Editing/pencil_tip-64.png" title="Pencil Tip" width="24">
</label>
<input type='radio' name='main-wrap' id='tab4' value=''>
<label for='tab4' class='metro-icon'><img src="https://maxcdn.icons8.com/windows10/PNG/64/Files/edit_file-64.png" title="Edit File" width="24">
</label>
<div class='content-wrap' id='content-history'>
<div class='main'>
<p>This is the history tab!</p>
</div>
</div>
<div class='content-wrap' id='content-outline'>
<div class='main'>
<p>This is the outline tab!</p>
</div>
</div>
<div class='content-wrap' id='content-edit'>
<div class='main'>
<div contenteditable id='main-input'>This is the edit tab!</div>
</div>
</div>
<div class='content-wrap' id='content-revise'>
<div class='main'>
<p>This is the revise tab!</p>
</div>
</div>
</div>
Check this