My plan is to build a header with a filmstrip, where each film piece acts as a modular feature photo that I can use to swiftly swap photos at any moment. I quickly sketched a general idea of what I’m aiming to achieve.
enter image description here
The problem arises when I began formatting and structuring the page. I have three div containers, the header, a sidebar, and the main div. All the photos and filmstrip are inside the same container, but the photos are appearing way below the filmstrip for some reason, and they’re leaking onto the main div.
I think I got the HTML portion of the container correct:
<div class = "header">
<img src = "framesample.png" class = "launch">
<div class = featurephotos>
<a target = "_self" href = "photo1.html" target = "mainframe" alt = "photo1"><img class = "imagery" src = "one.jpg" width = "89" height = "71" id = "one" alt = "rc"/></a>
<a target = "_self" href = "photo2.html" target = "mainframe" alt = "photo2"><img class = "imagery" src = "two.jpg" width = "89" height = "71" id = "two" alt = "rc"/></a>
<a target = "_self" href = "photo3.html" target = "mainframe" alt = "photo3"><img class = "imagery" src = "three.jpg" width = "89" height = "71" id = "three" alt = "rc"/></a>
<a target = "_self" href = "photo4.html" target = "mainframe" alt = "photo4"><img class = "imagery" src = "/four.jpg" width = "89" height = "71" id = "four" alt = "rc"/></a>
<a target = "_self" href = "photo5.html" target = "mainframe" alt = "photo5"><img class = "imagery" src = "five.jpg" width = "89" height = "71" id = "five" alt = "rc"/></a>
<a target = "_self" href = "photo6.html" target = "mainframe" alt = "photo6"><img class = "imagery" src = "six.jpg" width = "89" height = "71" id = "six" alt = "rc"/></a>
</div>
</div>
However, I’m not entirely sure what I did with the CSS. Because the photos were placed all the way to the left so I added some padding. I thought I could maybe remedy the problem by adding bottom padding to each frame so I could force the photos onto the frames of the film strip, but adding bottom padding did nothing. I also did a lot of force-bruting with the CSS and I’m not entirely sure how that’ll affect responsiveness, especially with mobile.
#one{
position: absolute;
padding-left: 16rem;
padding-right:0.41rem;
}
#two{
padding-right: 0.5rem;
}
#three{
padding-right: 0.4rem;
}
#four{
padding-right: 0.41rem;
}
#five{
padding-right: 0.3rem;
}
.header {
height: 0px;
width: 0px;
position: fixed;
top: 0px;
left: 0px;
z-index: 1;
}
The fundamental problem is the images aren’t appending inside the film strip. I was hoping to make a CSS code that could easily recognize the parameters of the transparent film pieces, so that in future references in any moments I want to update that feature strip, photos could snugly fit into them instead of taking the easier route and digitally designing a new strip with six individual photos into one image, and pasting one single image file into the HTML every single time. In retrospect, it’s suddenly becoming harder than I anticipated and I’m not too sure what I’m doing now.
2
Answers
Without changing your markup this can be achieved e.g. using display:inline-block to the outermost div element (so it won’t extend for 100% of the available width) and position relative + absolute for outermost div and thumbnail
I would do the whole thing in CSS, however – then you won’t be able to use your picture of the filmstrip. Example below:
However, if you want to use the image of the filmstrip, you can do so.
Calculate the gap between each image in the strip, and use Flexbox to arrange the images for you. I don’t have the image of your filmstrip, so I’ll show you an example of how that would work.
Although it doesn’t give you a completed solution to your problem, I hope it helps you into solving it yourself 🙂