hope one of you can give me a “how to” hint.
I’m a newbie here and in building a website. I’ve written a website with “50 odd pages” for my photos. Photography is my passion, not website building. On each page 1 photo, is centered vertically, horizontally, bladibla, and a button for showing a full-screen copy of the photo. For that purpose, I use CSS overlay and a script to open and close.
As you’ll understand, on each page the same CSS stylesheet, except for the URL of the photo which is mentioned twice. In the head as part of the CSS overlay code and once more in the body for addressing the photo.
A snippet of the overlay code:
.overlay-content {
background-image: url("https://.../images/photo_0X.png");
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
And in the body:
<img id="photo" src="https://.../images/photo_0X.png">
This works perfectly but for maintenance purposes, I would like to simplify the code of my pages and therefore create 1 (external) CSS file for all pages. Regularly I change background color, and fonts, and add pages/photos.
My question is as follows: Is it possible to generalize the “background-image: url” line of the overlay code? E.g. by adding an image id to the image line in the body. There’s just 1 photo on each page so I could give every photo the same img id. E.g. img id=”photo”. As above. In other words; would it be possible to refer in the overlay code to the image id in the body instead of repeating the full path to the photo? Referring to the image id is just an idea, every other suggestion is appreciated. P.S. I love simple solutions.
Thanks a lot, even if it’s just for reading this “long read” (-;



