正如你在图片中看到的那样,我试图制作一个类似它的垂直标签。我已经在jsfiddle上发布了代码,如果有人帮助我对齐列顶部的两列和底部的两列以及如何在列上编写描述,我将不胜感激。当您将鼠标悬停在列上时,列中的图像会稍微扩展。
<!DOCTYPE html>
<html>
<head>
<style>
* {box-sizing: border-box}
body {font-family: "Lato", sans-serif;}
/* Style the tab */
div.tab {
float: left;
border: 1px solid deepskyblue;
background-color: deepskyblue;
width: 30%;
height: 300px;
}
/* Style the buttons inside the tab */
div.tab button {
display: block;
background-color: inherit;
color: whitesmoke;
padding: 22px 16px;
width: 100%;
border: none;
outline: none;
text-align: right;
cursor: pointer;
transition: 0.3s;
font-size: 17px;
margin: 10px 0px;
font-weight: 600;
}
/* Change background color of buttons on hover */
div.tab button:hover {
background-color: #ddd;
}
/* Create an active/current "tab button" class */
div.tab button.active {
background-color: lightblue;
color: white;
}
/* Style the tab content */
.tabcontent {
color: white;
float: left;
padding: 0px 12px;
width: 70%;
border-left: none;
height: 300px;
background-color: deepskyblue;
}
.headd{
text-align: center;
color: white;
border: 1px solid black;
border-radius: 5px;
padding: 10px 10px;
font-weight: 700;
}
.right .left-col div, .right .right-col div{
background-color: lightblue;
display: block;
height: 65px;
width: 330px;
vertical-align: baseline;
margin: 5px 5px;
}
.all{background-color: deepskyblue;
height: 400px;
}
</style>
</head>
<body>
<div class="container all">
<p>Events</p>
<div class="tab">
<div class="headd"><p> 21 January - 23 January</p></div>
<button class="tablinks" onclick="openDate(event, '11')" id="defaultOpen">21 January</button>
<button class="tablinks" onclick="openDate(event, '22')">22 January</button>
<button class="tablinks" onclick="openDate(event, '33')">23 January</button>
</div>
<div id="11" class="tabcontent">
<div class="right">
<div class="left-col">
<div class="">
Play
</div>
<div class="">
Play
</div>
</div>
<div class="right-col">
<div class="">
Play
</div>
<div class="">
Play
</div>
</div>
</div>
</div>
<div id="22" class="tabcontent">
<div class="right">
<div class="left-col">
<div class="">
Run
</div>
<div class="">
Run
</div>
</div>
<div class="right-col">
<div class="">
Run
</div>
<div class="">
Run
</div>
</div>
</div>
</div>
<div id="33" class="tabcontent">
<div class="right">
<div class="left-col">
<div class="">
Game
</div>
<div class="">
Game
</div>
</div>
<div class="right-col">
<div class="">
Game
</div>
<div class="">
Game
</div>
</div>
</div>
</div>
</div>
<script>
function openDate(evt, dateName) {
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
document.getElementById(dateName).style.display = "block";
evt.currentTarget.className += " active";
}
// Get the element with id="defaultOpen" and click on it
document.getElementById("defaultOpen").click();
</script>
</body>
</html>
到目前为止我尝试过的jsfiddle
jsfiddle link