//top tabs functionality
function openStory(evt, storyName) {
var i, storycontent, storylinks;
storycontent = document.getElementsByClassName("storycontent");
for (i = 0; i < storycontent.length; i++) {
storycontent[i].style.display = "none";
}
storylinks = document.getElementsByClassName("storylinks");
for (i = 0; i < storylinks.length; i++) {
storylinks[i].className = storylinks[i].className.replace(" active", "");
}
document.getElementById(storyName).style.display = "block";
evt.currentTarget.className += " active";
}
document.getElementById("storyActive").click();
//accordion functionality
var acc = document.getElementsByClassName("accordionHeader");
var panel = document.getElementsByClassName('accPanel');
for (var i = 0; i < acc.length; i++) {
acc[i].onclick = function() {
var setClasses = !this.classList.contains('open');
var isOpen = !!this.classList.contains('open');
if (!isOpen) {
setClass(acc, 'open', 'remove');
setClass(panel, 'open', 'remove');
}
if (setClasses) {
this.classList.toggle("open");
this.nextElementSibling.classList.toggle("open");
}
}
}
function setClass(els, className, fnName) {
for (var i = 0; i < els.length; i++) {
els[i].classList[fnName](className);
}
}
document.getElementById("defaultOpen").click();
//details buttons
const imageSlot = document.getElementById('imageSlot');
const buttons = document.querySelectorAll('.butt');
const images = [{
id: 'b1',
url: 'https://i.imgur.com/88RXBjW.jpg'
},
{
id: 'b2',
url: 'https://i.imgur.com/HRDdfho.jpg'
},
{
id: 'b3',
url: 'https://i.imgur.com/VM9Nsjd.jpg'
},
{
id: 'b4',
url: 'https://i.imgur.com/788MQOl.jpg'
},
];
buttons.forEach((button) => {
button.addEventListener('click', changeImage);
});
function changeImage(e) {
const target = e.target.textContent;
imageSlot.src = images.find((img) => img.id === target).url;
}
* {
box-sizing: border-box;
}
body {
font-family: Roboto, sans-serif;
font-size: 16px;
background-color: navajowhite;
margin: auto;
}
h1 {
font-family: Vollkorn SC, serif;
font-size: 75px;
text-align: center;
margin: auto;
}
h2 {
font-family: Roboto Slab, serif;
font-size: 25px;
}
h3 {
font-family: Roboto Slab, serif;
font-size: 20px;
padding: 0;
margin: 0;
}
ul {
list-style: circle inside;
padding-left: 20px;
margin: 0;
}
/* all the grid stuff */
.content {
position: absolute;
}
.top-grid {
display: grid;
grid-template-columns: 250px 250px 1.5fr;
gap: 2px;
background-color: violet;
grid-auto-flow: row;
grid-template-areas: "banner banner name" "banner banner basics"
}
.top-grid>div {
margin: 3px;
}
.item1 {
grid-area: name;
padding: 5px;
background-color: azure;
}
.item2 {
grid-area: banner;
padding: 5px;
background-color: azure;
}
.item3 {
grid-area: basics;
padding: 5px;
background-color: azure;
}
.middle-grid {
display: grid;
grid-template-columns: 50% 1.5fr;
grid-template-rows: auto auto;
gap: 2px;
margin-top: 3px;
margin-bottom: 3px;
background-color: blueviolet;
grid-auto-flow: row;
grid-template-areas: "stuff1 stuff2" "details details"
}
.middle-grid>div {
margin: 3px;
}
.stuff1 {
grid-area: stuff1;
padding: 5px;
background-color: cornflowerblue;
}
.stuff2 {
grid-area: stuff2;
padding: 5px;
background-color: cornflowerblue;
}
.stuff3 {
grid-area: details;
padding: 5px;
background-color: cornflowerblue;
}
.bottom-grid {
display: grid;
grid-template-columns: 50px 75% 1.5fr;
grid-template-rows: auto auto;
gap: 2px;
background-color: mediumorchid;
grid-auto-flow: row;
grid-template-areas: "buttons design extras" "relationships relationships relationships"
}
.bottom-grid>div {
margin: 3px;
}
.buttons {
grid-area: buttons;
padding: 5px;
background-color: paleturquoise;
}
.design {
grid-area: design;
padding: 5px;
background-color: paleturquoise;
}
.extras {
grid-area: extras;
padding: 5px;
background-color: paleturquoise;
}
.relationships {
grid-area: relationships;
padding: 5px;
background-color: paleturquoise;
}
/* top tabs style */
.allstory {
background-color: rgba(255, 255, 255, 0);
}
.story {
overflow: hidden;
border: none;
background-color: rgba(255, 255, 255, 0);
}
.story button {
background-color: rgb(211, 194, 174);
border: none;
outline: none;
cursor: pointer;
padding: 0 15px 0 5px;
font-size: 17px;
transition: 0.3s;
}
.story button:hover {
background-color: #ddd;
}
.story button.active {
background-color: rgb(243, 234, 223);
border-bottom: 1px solid rgb(243, 234, 223);
}
.storywrapper {
background-color: rgb(243, 234, 223);
padding: 5px;
}
.storycontent {
display: none;
padding: 5px;
background-color: darksalmon;
border: 1px solid #ccc;
border-top: none;
animation: fadeEffect 0.8s;
}
@keyframes fadeEffect {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
/* accordion */
.accordionHeader {
background-color: rgba(255, 255, 255, 0);
color: black;
cursor: pointer;
padding: 10px;
width: 100%;
text-align: left;
font-size: 18px;
border-top: none;
border-left: none;
border-right: none;
border-bottom: 1px solid rgb(82, 82, 82);
outline: none;
transition: 0.4s;
}
.accPanel {
padding: 0 10px;
background-color: rgba(255, 255, 255, 0);
display: none;
overflow: hidden;
transition: max-height 0.5s ease-out;
}
.open {
display: block;
}
/* tables */
table {
border: none;
border-spacing: 25px 5px;
border-collapse: separate;
}
.table-dad {
display: flex;
justify-content: center;
align-items: center;
}
.table1 {
display: inline-block;
width: 0.75fr;
}
.table2 {
display: inline-block;
width: 0.75fr;
}
.table3 {
border: none;
border-spacing: 75px 5px;
text-align: center;
vertical-align: middle;
margin-left: auto;
margin-right: auto;
}
th {
font-family: Roboto Slab, serif;
}
/* butts */
.btn-dad {
display: flex;
justify-content: center;
align-items: center;
}
.btn-group .butt {
background-color: coral;
display: block;
border-radius: 50%;
border: 1px solid;
padding: 5px;
margin-top: 5px;
text-align: center;
font-size: 15px;
cursor: pointer;
width: 35px;
}
.btn-group .butt:hover {
background-color: firebrick;
}
.btn-dad-2 {
display: flex;
justify-content: center;
align-items: center;
}
.btn-group-2 .butt2 {
background-color: blanchedalmond;
display: inline-block;
border-radius: 10%;
border: 1px solid;
padding: 5px;
margin-left: 5px;
text-align: center;
font-size: 15px;
cursor: pointer;
width: 100px;
}
.btn-group-2 .butt2:hover {
background-color: burlywood;
}
.btn-group-3 .butt3 {
background-color: lemonchiffon;
display: inline-block;
border-radius: 50%;
border: 1px solid;
padding: 5px;
margin-top: 5px;
margin-left: 5px;
cursor: pointer;
width: 60px;
height: 60px;
}
.btn-group-3 .butt3:hover {
background-color: peru;
}
<!DOCTYPE html>
<html>
<head>
<title>character page</title>
<link rel="stylesheet" href="character page css.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Vollkorn+SC|Roboto|Roboto+Slab">
</head>
<body>
<div class="content">
<div class="top-grid">
<div class="item1">
<h1>Character Name</h1>
</div>
<div class="item2"><img src="https://i.imgur.com/TzDzHFY.png" style="max-width: 485px;"></div>
<div class="item3">
<div class="table-dad">
<h2>basic details</h2>
<!--top table left-->
<table class="table1">
<tr>
<th style="text-align: left;">nickname(s)</th>
<td style="width: 250px; table-layout: fixed;">stuff</td>
</tr>
<tr>
<th style="text-align: left;">gender</th>
<td style="width: 250px; table-layout: fixed;">stuff</td>
</tr>
<tr>
<th style="text-align: left;">d.o.b.</th>
<td style="width: 250px; table-layout: fixed;">stuff</td>
</tr>
</table>
<!--top table right-->
<table class="table2">
<tr>
<th style="text-align: left;">nationality</th>
<td style="width: 250px; table-layout: fixed;">stuff</td>
</tr>
<tr>
<th style="text-align: left;">birthplace</th>
<td style="width: 250px; table-layout: fixed;">stuff</td>
</tr>
<tr>
<th style="text-align: left;">species</th>
<td style="width: 250px; table-layout: fixed;">stuff</td>
</tr>
</table>
</div>
</div>
</div>
<div class="middle-grid">
<!--middle table left-->
<div class="stuff1">
<h3 style="text-align: center;">other details</h3>
<table class="table3">
<tr>
<th>item</th>
<td>stuff</td>
</tr>
<tr>
<th>item</th>
<td>stuff</td>
</tr>
</table>
</div>
<!--middle table right-->
<div class="stuff2">
<h3 style="text-align: center;">other details</h3>
<table class="table3">
<tr>
<th>item</th>
<td>stuff</td>
</tr>
<tr>
<th>item</th>
<td>stuff</td>
</tr>
</table>
</div>
<div class="stuff3">
<div class="allstory">
<!--tab buttons-->
<div class="story">
<button class="storylinks" onclick="openStory(event, 'story1')" id="storyActive">tab1</button>
<button class="storylinks" onclick="openStory(event, 'story2')">tab2</button>
<button class="storylinks" onclick="openStory(event, 'story3')">tab3</button>
</div>
<!--tabs content-->
<div class="storywrapper">
<div id="story1" class="storycontent">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis
aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div id="story2" class="storycontent">
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem
quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non
numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel
eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p>
</div>
<div id="story3" class="storycontent">
<!--accordion-->
<button class="accordionHeader" id="defaultOpen">section 1</button>
<div class="accPanel">
<p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia
deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus,
omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur
a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.</p>
</div>
<button class="accordionHeader">section 2</button>
<div class="accPanel">
<p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia
deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus,
omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur
a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.</p>
</div>
<button class="accordionHeader">section 3</button>
<div class="accPanel">
<p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia
deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus,
omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur
a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="bottom-grid">
<div class="buttons">
<div class="btn-group">
<div class="butt">b1</div>
<div class="butt">b2</div>
<div class="butt">b3</div>
<div class="butt">b4</div>
</div>
</div>
<div class="design">
<img id="imageSlot" src="https://i.imgur.com/88RXBjW.jpg" style="max-width: 100%;">
</div>
<div class="extras">
<h3>possessions</h3>
<ul>
<li>item1</li>
<li>item2</li>
</ul>
<h3 style="margin-top: 10px;">design notes</h3>
<ul>
<li>item1</li>
<li>item2</li>
</ul>
</div>
<div class="relationships">
<div class="btn-dad">
<div class="btn-group-2">
<div class="butt2">butt1</div>
<div class="butt2">butt2</div>
<div class="butt2">butt3</div>
<div class="butt2">butt4</div>
</div>
</div>
<div class="btn-dad-2">
<div class="btn-group-3">
<div class="butt3">oc1</div>
<div class="butt3">oc2</div>
<div class="butt3">oc3</div>
<div class="butt3">oc4</div>
</div>
</div>
<div>
<h2>relationship</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</div>
</div>
<script src="character page js.js" type="text/javascript"></script>
</body>
</html>