I’m messing around with html/js/css to make a web app that tells you how to load a barbell with plates for powerlifting/weightlifting.
I’m using js to create a div for each plate that is required to be loaded, as well as an additional div which represents a ‘collar’. When I create a low amount of divs it represents correctly as follows:
normal
When I create too many divs it begins to ‘squish’ the additional ‘collar’ div, as well as the ‘plate’ divs as such:
squished
very squished
Here is the hierarchy of divs in their parent div they’re appended to on creation:
hierarchy of divs
The css for the collar divs are here:
.barbell_collar_left {
background: rgb(133,133,133);
background: linear-gradient(0deg, rgba(133,133,133,1) 0%, rgba(208,208,208,1) 33%, rgba(247,247,247,1) 66%, rgba(202,202,202,1) 100%);
bottom: calc(var(--barbell_shoulder_height)/var(--scale_factor)/-2 + var(--barbell_collar_height)/var(--scale_factor)/2);
height: calc(var(--barbell_collar_height)/var(--scale_factor));
position: relative;
right: calc(var(--barbell_collar_width)/var(--scale_factor));
width: calc(var(--barbell_collar_width)/var(--scale_factor));
display: flex;
flex-direction: row-reverse;
}
.collar_left {
background: rgb(133,133,133);
background: linear-gradient(0deg, rgba(133,133,133,1) 0%, rgba(208,208,208,1) 33%, rgba(247,247,247,1) 66%, rgba(202,202,202,1) 100%);
bottom: calc(var(--barbell_collar_height)/var(--scale_factor)/2);
clip-path: polygon(25% 0, 85% 0, 100% 15%, 100% 85%, 85% 100%, 25% 100%, 0 85%, 0 15%);
height: calc(var(--collar_height)/var(--scale_factor));
position: relative;
right: 0px;
width: calc(var(--collar_width)/var(--scale_factor));
}
.collar_end_left {
background: rgb(133,133,133);
background: linear-gradient(0deg, rgba(133,133,133,1) 0%, rgba(208,208,208,1) 33%, rgba(247,247,247,1) 66%, rgba(202,202,202,1) 100%);
bottom: calc(var(--collar_end_height)/var(--scale_factor)/3.5);
clip-path: polygon(75% 0, 90% 5%, 85% 15%, 85% 85%, 90% 95%, 75% 100%, 60% 85%, 60% 15%);
height: calc(var(--collar_end_height)/var(--scale_factor));
right: -5px;
position: relative;
width: calc(var(--collar_width)/var(--scale_factor));
}
.collar_shaft_left {
background: rgb(133,133,133);
background: linear-gradient(0deg, rgba(133,133,133,1) 0%, rgba(208,208,208,1) 33%, rgba(247,247,247,1) 66%, rgba(202,202,202,1) 100%);
bottom: 50px;
clip-path: polygon(0 80%, 0 60%, 100% 60%, 100% 100%, 80% 100%, 80% 80%);
height: 40px;
right: -55px;
position: relative;
width: 40px;
}
.collar_handle_left {
background: radial-gradient(circle at 25% 15%, white 1px, grey 3%, rgb(26, 26, 26) 60%, grey 100%);
bottom: 32px;
clip-path: circle(50% at 50% 50%);
height: 20px;
right: -57px;
position: relative;
width: 20px;
}
Am I missing something simple here, perhaps it has something to do with the position type? Fairly new to html/js/css so just tinkering and learning along the way!
Thanks for reading
I’ve tried changing the position types but I’m too inexperienced to even figure out what it’s trying to do and how to approach it.
When I create the divs without the additional ‘collar’ div, I don’t have this issue until the ‘plate’ divs reach the end of their parent ‘barbell_collar_left’ div?