Home>
We make a table that can be displayed/hidden with tabs on WordPress with only HTML and CSS.
I would like to be able to switch between multiple tables with radio buttons in the tab.
[I want to make] It ’s like the ranking on this site
[Reference site] This is used as a reference
1. Radio button with checked in input is not checked first
2. The contents of button ID 1-c, 2-a, 2-c, 3-a are not displayed
<input type = "radio" name = "tab_item" checked>
<label for = "tab1">Overall</label>
<input type = "radio" name = "tab_item">
<label for = "tab2">Popular</label>
<input type = "radio" name = "tab_item">
<label for = "tab3">Cheap</label>
<input type = "radio" name = "intab_item" checked>
<label for = "intab1_a">Overall1</label>
<input type = "radio" name = "intab_item">
<label for = "intab1_b">Taste 1</label>
<input type = "radio" name = "intab_item">
<label for = "intab1_c">Low 1</label>
<table>
<tbody>
<tr>
<td>1st</td>
<td>Delicious water</td>
</tr>
<tr>
<td>2nd</td>
<td>Great water</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td>1st</td>
<td>More delicious water</td>
</tr>
<tr>
<td>2nd</td>
<td>More water</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td>1st</td>
<td>Very good water</td>
</tr>
<tr>
<td>2nd</td>
<td>Very amazing water</td>
</tr>
</tbody>
</table>
<input type = "radio" name = "intab_item" checked>
<label for = "intab2_a">Overall2</label>
<input type = "radio" name = "intab_item">
<label for = "intab2_b">Taste 2</label>
<input type = "radio" name = "intab_item">
<label for = "intab2_c">Low 2</label>
<table>
<tbody>
<tr>
<td>1st</td>
<td>Delicious water</td>
</tr>
<tr>
<td>2nd</td>
<td>Great water</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td>1st</td>
<td>More delicious water</td>
</tr>
<tr>
<td>2nd</td>
<td>More water</td>
</tr>
<tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td>1st</td>
<td>Very good water</td>
</tr>
<tr>
<td>2nd</td>
<td>Very amazing water</td>
</tr>
</tbody>
</table>
<input type = "radio" name = "intab_item" checked>
<label for = "intab3_a">Overall 3</label>
<input type = "radio" name = "intab_item">
<label for = "intab3_b">Taste 3</label>
<input type = "radio" name = "intab_item">
<label for = "intab3_c">Low 3</label>
<table>
<tbody>
<tr>
<td>1st</td>
<td>Delicious water</td>
</tr>
<tr>
<td>2nd</td>
<td>Great water</td></tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td>1st</td>
<td>More delicious water</td>
</tr>
<tr>
<td>2nd</td>
<td>More water</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td>1st</td>
<td>Very good water</td>
</tr>
<tr>
<td>2nd</td>
<td>Very amazing water</td>
</tr>
</tbody>
</table>
/* Overall tab switching style * /
.tabs {
margin-top: 50px;
padding-bottom: 40px;
background-color: #fff;
border: solid 1px # e3e3e3;
width: 100%;
box-shadow: 0 0 10px rgba (0, 0, 0, 0.2);
margin: 0 auto;
}
/ * Tab style * /
.tab_item {
height: 50px;
border-bottom: 3px solid # 5ab4bd;
background-color: # d9d9d9;
line-height: 50px;
font-size: 16px;
text-align: center;
color: # 565656;
display: block;
float: left;
text-align: center;
font-weight: bold;
transition: all 0.2s ease;
}
.tab_item: hover {
opacity: 0.75;
}
.item1 {
width: 100%;
}
.item2 {
width: calc (100%/2);
}
.item3 {
width: calc (100%/3);
}
.item4 {width: calc (100%/3);
}
/ * Delete all radio buttons * /
input [name = "tab_item"] {
display: none;
}
/ * Styles of tab switching contents * /
.tab_content {
display: none;
padding: 5px 5px 0;
clear: both;
overflow: hidden;
}
/ * Show only the contents of the selected tab * /
# tab1: checked ~ # tab1_content,
# tab2: checked ~ # tab2_content,
# tab3: checked ~ # tab3_content {
display: block;
}
/ * Change the style of the selected tab * /
.tabs input: checked + .tab_item {
background-color: # 5ab4bd;
color: #fff;
}
/ * Tab 2 in the tab * /
/ * Overall tab switching style * /
.intab {
width: 100%;
}
/ * Tab style * /
.intab_item {
/ * float: left;* /
border: solid 1px # 86C7CD;
background-color: #fff;
margin: 5px 2px;
padding: 0 5px;
border-radius: 5%;
}
/ * Delete all radio buttons * /
input [name = "intab_item"] {
display: none;
}
/ * Styles of tab switching contents * /
.intab_content {
display: none;
padding: 4px 4px 0;
clear: both;
overflow: hidden;
}
/ * Show only the contents of the selected tab * /
# intab1_a: checked ~ # intab1_a_content,
# intab1_b: checked ~ # intab1_b_content,
# intab1_c: checked ~ # intab1_c_content
# intab2_a: checked ~ # intab2_a_content,
# intab2_b: checked ~ # intab2_b_content,
# intab2_c: checked ~ # intab2_c_content
# intab3_a: checked ~ # intab3_a_content,
# intab3_b: checked ~ # intab3_b_content,
# intab3_c: checked ~ # intab3_c_content
{
display: block;
}
/ * Change the style of the selected tab * /
.intab input: checked + .intab_item {
background-color: # 5ab4bd;
color: #fff;
}
Change naming rules for child tab IDs (suspecting conflicts)
1-1 to 3-3 → 1-a to 3-c → 1 to 9
When CSS is 1-a to 1-c, everything works normally (of course, only tab 1)
If i add 2-a and later, some tabs will not be displayed.
I am sorry that the code is long and I can't explain the situation enough because of the number of characters.
-
Answer # 1
Related articles
- html - i want to center the buttons displayed using simplepaginationjs
- html - i want to show/hide depending on when the radio button is selected on the inquiry form
- html - svg is not displayed when displaying pagenation using vuetify
- html - the text hidden in img was displayed with img:hover, but if the text has hover, img:hover does not work
- html - i want to hide the side menu display when the size of the smartphone screen is displayed, and display only the main conte
- html - show/hide when a certain element of jquery page is exceeded
- html - no background image is displayed how can i display it?
- html - the photos described in css are not displayed
- html - only when sharing fb, the ogp image will be displayed different from the specified url
- html - the background image is not displayed
- html - i want to show recommendations when i visit the page (obtained from json and displayed in vuejs)
- html - backgroung-img is not displayed
- no characters are displayed below this where did the written html go?
- python - can tkinter be displayed in html?
- html - image cannot be displayed with relative path
- html - [bootstrap] jumbotron image is not displayed
- html - background-image is not displayed
- html - i want to align images and buttons vertically and centered with css
- html - favicon is not displayed after ssl conversion
- html - the print preview is not displayed when printing is performed in the chrome browser
Related questions
- php : How to display product category thumbnail in wordpress woocommerce?
- html : Layout directly on wordpress
- html : Connecting local fonts on a WordPress site
- php : WordPress site menu not working on local server
- javascript : Offset of the caption relative to the picture
- html : Change css --before-border-left jquery
- javascript : Link in a separate window html, css, reactjs
- css3 : How to round the edges of a table (border-radius)
- html : Background-color is not applied correctly to body
- html : Compress slick-dots on IOS
The names of all radio buttons are
"intab_item"
. Try changing them for each group.