Hi. I'm looking for assistance on how to place text over images that at exactly 200px in height, but varying widths. This is what it currently looks like: I'm trying to achieve text showing like this: I was trying to achieve it, and have been successful, but the tutorials I find keep dividing the images line by line instead of keeping it on 1 line that scrolls. I'm not sure what I'm doing wrong, but below is an extract of the coding prior to placement of the text. Can anyone help? Code (Text): <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=auto, initial-scale=1"> <style> @font-face {font-family: Marcellus SC; src: url(http://tbq.x10host.com/tunisia69_files/main.ttf);} .responsive {width: 100%; max-width: 544px; height: auto;} .scrollheader {background-color: #444444; overflow: auto;} .scrollmenu {background-color: #111111; overflow: auto; white-space: nowrap;} .headermajor {font-family: Marcellus SC; font-size: 20.0pt; color: #DDD9C3;} .headerminor {font-family: Marcellus SC; font-size:14.0pt; color: #DDD9C3;} .headerspace {padding: 2.0pt;} </style> </head> <body bgcolor="#222222"> <div align=center class="scrollheader"> <p style='text-align:center'> </p> <p style="text-align:center; font-size:20.0pt; font-family:'Baskerville Old Face',serif; color: #F2F2F2"><b>ONLINE WORLD CURRENCY STORE</b></p> </div> <div align=center class="headerspace"></div> <div align=center class="headermajor">AFGHANISTAN</div> <div align=center class="headerspace"></div> <div class="scrollmenu"> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan47.html target=main><img height=200 title="(1973) P-47" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan47_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan55.html target=main><img height=200 title="(1979) P-55" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan55_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan57.html target=main><img height=200 title="(1991) P-57" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan57_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan58.html target=main><img height=200 title="(1991) P-58" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan58_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan60.html target=main><img height=200 title="(1991) P-60" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan60_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan61.html target=main><img height=200 title="(1991) P-61" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan61_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan62.html target=main><img height=200 title="(1993) P-62" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan62_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan63.html target=main><img height=200 title="(1993) P-63" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan63_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan64.html target=main><img height=200 title="(2002) P-64" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan64_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan65.html target=main><img height=200 title="(2002) P-65" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan65_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan66.html target=main><img height=200 title="(2002) P-66" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan66_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan67.html target=main><img height=200 title="(2008) P-67" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan67_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan67A.html target=main><img height=200 title="(2012) P-67A" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan67A_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan68.html target=main><img height=200 title="(2016) P-68" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan68_files/image001.jpg" loading="lazy"></a> </div> <div align=center class="headerspace"></div> <div align=center class="headermajor">ALGERIA</div> <div align=center class="headerspace"></div> <div class="scrollmenu"> <a href=http://gsthemes.freehostia.com/BANKNOTE/algeria130.html target=main><img height=200 title="(1977) P-130" src="http://gsthemes.freehostia.com/BANKNOTE/algeria130_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/algeria137.html target=main><img height=200 title="(1992) P-137" src="http://gsthemes.freehostia.com/BANKNOTE/algeria137_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/algeria138.html target=main><img height=200 title="(1992) P-138" src="http://gsthemes.freehostia.com/BANKNOTE/algeria138_files/image001.jpg" loading="lazy"></a> </div> </body> </html>
What solutions have you tried? I suspect there's a missing piece, like adding a float or something (though those can be tricky to get working and often take a lot of tweaking in my experience, as you may or may not know). Another solution I thought of that may or may not work is setting up a div or span with the dimensions you want and using the image as the background. Someone with more CSS experience than me (I'm also a bit rusty) could probably knock out a solution, but personally I always have to do a good bit of trial and error to get what I want.
Oh yeah, of course, that would help. Here's the code, and this is what it looks like: So the problem I'm encountering is that the images are not side-by-side. That would be my goal (along with continuing the horizontal scrolling). Code (Text): <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=auto, initial-scale=1"> <style> @font-face {font-family: Marcellus SC; src: url(http://tbq.x10host.com/tunisia69_files/main.ttf);} .responsive {width: 100%; max-width: 544px; height: auto;} .scrollheader {background-color: #444444; overflow: auto;} .scrollmenu {background-color: #111111; overflow: auto; white-space: nowrap;} .headermajor {font-family: Marcellus SC; font-size: 20.0pt; color: #DDD9C3;} .headerminor {font-family: Marcellus SC; font-size:14.0pt; color: #DDD9C3;} .headerspace {padding: 2.0pt;} .image-container {position: relative; color: white;} .image-overlay {position: absolute; left: 6px; bottom: 10px; background-color: rgba(0, 0, 0, 0.5); color: #fff; padding: 4px; font-size: 12px;} </style> </head> <body bgcolor="#222222"> <div align=center class="scrollheader"> <p style='text-align:center'> </p> <p style="text-align:center; font-size:20.0pt; font-family:'Baskerville Old Face',serif; color: #F2F2F2"><b>ONLINE WORLD CURRENCY STORE</b></p> </div> <div align=center class="headerspace"></div> <div align=center class="headermajor">AFGHANISTAN</div> <div align=center class="headerspace"></div> <div class="scrollmenu"> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan47.html target=main><img height=200 title="(1973) P-47" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan47_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan55.html target=main><img height=200 title="(1979) P-55" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan55_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan57.html target=main><img height=200 title="(1991) P-57" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan57_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan58.html target=main><img height=200 title="(1991) P-58" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan58_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan60.html target=main><img height=200 title="(1991) P-60" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan60_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan61.html target=main><img height=200 title="(1991) P-61" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan61_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan62.html target=main><img height=200 title="(1993) P-62" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan62_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan63.html target=main><img height=200 title="(1993) P-63" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan63_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan64.html target=main><img height=200 title="(2002) P-64" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan64_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan65.html target=main><img height=200 title="(2002) P-65" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan65_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan66.html target=main><img height=200 title="(2002) P-66" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan66_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan67.html target=main><img height=200 title="(2008) P-67" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan67_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan67A.html target=main><img height=200 title="(2012) P-67A" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan67A_files/image001.jpg" loading="lazy"></a> <a href=http://gsthemes.freehostia.com/BANKNOTE/afghanistan68.html target=main><img height=200 title="(2016) P-68" src="http://gsthemes.freehostia.com/BANKNOTE/afghanistan68_files/image001.jpg" loading="lazy"></a> </div> <div align=center class="headerspace"></div> <div align=center class="headermajor">ALGERIA</div> <div align=center class="headerspace"></div> <div class="scrollmenu"> <div class="image-container"> <a href="http://gsthemes.freehostia.com/BANKNOTE/algeria130.html" target="main"> <img height="200" title="(1977) P-130" src="http://gsthemes.freehostia.com/BANKNOTE/algeria130_files/image001.jpg" loading="lazy"> <div class="image-overlay">(1977) P-130</div> </a> </div> <div class="image-container"> <a href="http://gsthemes.freehostia.com/BANKNOTE/algeria137.html" target="main"> <img height="200" title="(1992) P-137" src="http://gsthemes.freehostia.com/BANKNOTE/algeria137_files/image001.jpg" loading="lazy"> <div class="image-overlay">(1992) P-137</div> </a> </div> <div class="image-container"> <a href="http://gsthemes.freehostia.com/BANKNOTE/algeria138.html" target="main"> <img height="200" title="(1992) P-138" src="http://gsthemes.freehostia.com/BANKNOTE/algeria138_files/image001.jpg" loading="lazy"> <div class="image-overlay">(1992) P-138</div> </a> </div> </div> </body> </html>
I was able to fix your solution by changing the divs into spans: Code (Text): <div class="scrollmenu"> <span class="image-container"> <a href="http://gsthemes.freehostia.com/BANKNOTE/algeria130.html" target="main"> <img height="200" title="(1977) P-130" src="http://gsthemes.freehostia.com/BANKNOTE/algeria130_files/image001.jpg" loading="lazy"> <span class="image-overlay">(1977) P-130</span> </a> </span> <span class="image-container"> <a href="http://gsthemes.freehostia.com/BANKNOTE/algeria137.html" target="main"> <img height="200" title="(1992) P-137" src="http://gsthemes.freehostia.com/BANKNOTE/algeria137_files/image001.jpg" loading="lazy"> <span class="image-overlay">(1992) P-137</span> </a> </span> <span class="image-container"> <a href="http://gsthemes.freehostia.com/BANKNOTE/algeria138.html" target="main"> <img height="200" title="(1992) P-138" src="http://gsthemes.freehostia.com/BANKNOTE/algeria138_files/image001.jpg" loading="lazy"> <span class="image-overlay">(1992) P-138</span> </a> </span> </div> It was also showing the link underlines between the images, so I added this to the CSS: Code (Text): .image-container a { text-decoration: none; } Not sure if it's totally what you're after, may need further tweaking.
Oh wow, really? It was that simple? Amazing! I obviously didn't have enough knowledge about div and span tags. Thank you for that! Now I can insert that for all the images now.
Um hum, that's good to know as well. Welp, it seems to have worked, here's the link to my page. All those images have their labels now. Another project for the website that I will have to determine is how to reference data from a database (or excel sheet) placed on the server so that if information is updated, it gets reflected on the individual banknote pages. I'm guessing it's possible, but maybe not via an Excel sheet?
"Real" websites use systems with databases for this, but you can get the information from anywhere you want if you can write the code to fetch and parse it, be it from a database, a file or whatever. I'm sure that there are libraries to parse Excel files available out there, but you could also use CSV, XML or JSON, which are more common. Either way, you'll still have to write the portion that loops through the data and generates dynamic HTML code from it. Ideally, this would be code running on the host server (so that users don't have access to your Excel/whatever data file), but could just as easily be implemented in JavaScript running on the client side if you prefer and don't mind users peeking into the internals of your page.