I have 3 "p" elements and I'm trying to find a way to change the order in which they load on the page using JS or CSS. Below is an example of what I've attempted so far. When you click on the first box labeled "about 1," it opens up and displays the small boxes for the other boxes below it, allowing you to click on them. I want this behavior to apply to all the boxes. Essentially, I want the sequence in which the boxes are loaded by the HTML to be altered when a box is clicked. For instance, if I click on box 2, then the HTML element News / Updates / Announcements should move above About 1 and About 2, so that when clicked, both links are visible at the bottom.
I'm stuck and would appreciate any assistance.
Thank you!
(In essence, similar to clicking on About 1 for all the boxes!)
body {
background-color: #000080;
overflow: hidden;
}
.box1 {
background-color: #fff;
position: absolute;
bottom: -530px;
left: 50px;
height: 585px;
width: 100px;
border-radius: 10px;
transition: all 0.8s;
font-family: Calibri;
padding-right: 15px;
padding-left: 15px;
padding-top: 5px;
font-size: 20px;
}
.box1:focus {
bottom: -10px;
left: 35px;
width: 500px;
background-color: #dfff00;
}
.box2 {
background-color: #fff;
position: absolute;
bottom: -530px;
left: 225px;
height: 585px;
width: 125px;
border-radius: 10px;
transition: all 0.8s;
font-family: Calibri;
padding-right: 15px;
padding-left: 15px;
padding-top: 5px;
font-size: 20px;
}
.box2:focus {
bottom: -10px;
left: 35px;
width: 500px;
}
.box3 {
background-color: #fff;
position: absolute;
bottom: -530px;
left: 400px;
height: 585px;
width: 100px;
border-radius: 10px;
transition: all 0.8s;
font-family: Calibri;
padding-right: 15px;
padding-left: 15px;
padding-top: 5px;
font-size: 20px;
}
.box3:focus {
bottom: -10px;
left: 35px;
width: 500px;
background-color: #dfff00;
}
.boxTitle {
display: block;
text-align: center;
font-size: 25px;
}
<p tabindex="0" class="box1">
<span class="boxTitle"><b><u>About 1</u></b></span>
</p>
<p tabindex="0" class="box3">
<span class="boxTitle"><b><u>About 2</u></b></span>
</p>
<p tabindex="0" class="box2">
<span class="boxTitle"><b><u>News / Updates / Anouncements</u></b></span>
</p>