July 30, 200917 yr Hi Everyone Please can you have a look here When you click on one of the thumbnails, it opens a page that shows a bigger image. All the images are different sizes and I want to get them all to go to the center of the page. Can anyone help me with getting the images to center please? Here's the CSS: body{ background-image:url(backgrounds/background2.png); background-repeat:repeat-x; text-align:center; font-family: segoe script, arial; } #wrapper{ margin: 0 auto; width:900px; text-align:left; background:black; color:#000000; } #leftpanel{ background-color:#000000; position:absolute; width:300px; height:780px; } #logo img{ width:150px; margin:20px 75px; border:0; } #navigation{ background-color:#d35f14; margin: 0 20px; position:absolute; width:260px; height:570px; } #navigation ul{ position:absolute; left:-30px; } #navigation ul li{ font-size: 20px; display:block; text-decoration:none; text-align:left; padding-top:20px; } #navigation ul li a:link { color:#ffffff; text-decoration:underline; } #navigation ul li a:visited { color: #000000; text-decoration:none; } #navigation ul li a:hover { color: white; text-decoration:underline; } #navigation ul li a:active { color: orange; text-decoration:none; } a:link { color:#ffffff; text-decoration:underline; } a:visited { color: #ffffff; text-decoration:none; } a:hover { color: white; text-decoration:underline; } a:active { color: orange; text-decoration:none; } #mainpanel{ background-color:#000000; position:absolute; width:600px; height:780px; margin-left:320px; } #mainbackground{ background-color:#d35f14; margin:20px; height:640px; padding:20px; } h1{ text-align:center; line-height:35px; } h2{ text-align:center; } p{ font-size:17px; text-align:justify; } #gallery{ position:absolute; padding-left:5px; } #saleimagebackground{ background-color:#000000; height:250px; width:500px; padding:10px; } #saleimage img{ max-height:249px; } #saleimage p{ text-align:center; } #fullplate-navigation{ position:relative; top:150px; list-style:none; margin:5px 0 0 5px; } #fullplate-navigation li{ display:block; float:left; width:210px; } #previous{ text-align:left; } #next{ text-align:right; } #fullplate-navigation li a{ display:block; width:200px; padding:10px; } #moreart{ position:absolute; padding-top: 400px; left: 390px; } div.img{ margin:0 0 0 7px; padding:0 23px 23px 0; border:0; height:auto; width:100px; float:left; text-align:left; font-size:12px; } div.img img{ display:inline; margin:0; border:1px solid; border-color:#000000; width:100px; height:100px; } div.img a:hover img{ border:1px solid; border-color:#ffffff; } #footer{ background-color:#d35f14; text-align:center; color:#000000; position:absolute; top:710px; width:560px; margin:12px 20px; } #footer p{ line-height:1px; text-align:center; } Thanks Kerstey
July 30, 200917 yr Why not make things easier for yourself and use a JQuery Lightbox effect? You can see the best ones here: http://line25.com/articles/rounding-up-the-top-10-jquery-lightbox-scripts We use this effect for galleries all the time. It's a more modern approach, plus it's better for your users as they are not taken away from the original gallery page and they can cycle through the images like a slideshow. It's pretty simple to integrate database fucntionality too with the lightbox effect if your galleries are database driven. Hope this helps you
July 30, 200917 yr Author Why not make things easier for yourself and use a JQuery Lightbox effect? You can see the best ones here: http://line25.com/articles/rounding-up-the-top-10-jquery-lightbox-scripts We use this effect for galleries all the time. It's a more modern approach, plus it's better for your users as they are not taken away from the original gallery page and they can cycle through the images like a slideshow. It's pretty simple to integrate database fucntionality too with the lightbox effect if your galleries are database driven. Hope this helps you Thanks very much for your reply, that's very useful. But I'd still like to know how to center the images.
July 30, 200917 yr By centralising the images, I assume that you mean the images when you press, which takes you to the price? If so, then your best bet is to remove the black box surrounding the image, go into your css and add a border to the images that display on that page: #divName img { border:10px solid #000; } Then on the #divName (as I've called it), align all of the text to the centre: #divName { text-align:center; } It's the easy way around because margin:0 auto; doesn't work on images, even fixed width, and you don't want to use <center></center> because it's just not cricket.
July 30, 200917 yr All the links from the thumbnails got to new pages like full-figuremale.html. On that page the large image is inside <div id="saleimagebackground"> <div id="saleimage"> <img src="images/for sale/figuremale.jpg" alt="Figure Male" /> </div> Add this style:- #saleimage { width: 500px; text-align: center } as images usually do obey text-align center and the total width will always be the same. (Edit: This works in my simple test). As an alternative give a width and margin: auto; every time you create a new page with a different image like: <div id="saleimagebackground"> <div id="saleimage"> <img style="width: ??px; margin: auto;" src="images/for sale/figuremale.jpg" alt="Figure Male" /> </div> It will be a bit time-consuming unless you change the whole code structure.
July 30, 200917 yr Wickham, that's a really long way around it, just set out each image page like this: <div id="mainpanel"> <div id="mainbackground"> <h1>Art for Sale</h1> <h2>Orange Moon</h2> <div id="saleimagebackground"> <div id="saleimage"> <img src="images/forsale/orangemoon.jpg" alt="Orange Moon" /> <p>Acrylic on Canvas</p> <p>Approx. 60x80cm</p> <p>£190.00</p> </div> </div> <ul id="fullplate-navigation"> <li id="previous"><a href="full-late2.html">Previous</a></li> <li id="next"><a href="full-figuremauve.html">Next</a></li> </ul> </div> </div> #saleimage { text-align:center; } #saleimage img { border:10px solid #000; }
July 30, 200917 yr Author All the links from the thumbnails got to new pages like full-figuremale.html. On that page the large image is inside <div id="saleimagebackground"> <div id="saleimage"> <img src="images/for sale/figuremale.jpg" alt="Figure Male" /> </div> so you may have to give a width and margin: auto; every time you create a new page with a different image like: <div id="saleimagebackground"> <div id="saleimage"> <img style="width: ??px; margin: auto;" src="images/for sale/figuremale.jpg" alt="Figure Male" /> </div> It will be a bit time-consuming unless you change the whole code structure. As an alternative that may work, add this style instead of the above:- #saleimage { width: ??px; text-align: center } as images usually do obey text-align center and the total width will always be the same. Derrr, I thought I'd tried text-align:center - I obviously didn't!!! That's done the trick, thank you!!
July 30, 200917 yr *Posts removed* Edited July 30, 200917 yr by Ben Just removing the 2 x posts as couldn't see point
July 30, 200917 yr Sometimes this forum is so busy that you don't have time to think. I thought of one solution, posted it, then thought of a better solution, edited my post, then thought I'd better do a simple test, found it was as I thought, edited again, only to find several answers in between!
July 30, 200917 yr Haha, I was only kidding buddy . It's understandable, this forum isn't really real-time so it's something that occurs quite often. Fortunately, both of our solutions are the same and work just fine!!! .
July 30, 200917 yr Author Haha, I was only kidding buddy . It's understandable, this forum isn't really real-time so it's something that occurs quite often. Fortunately, both of our solutions are the same and work just fine!!! . Phew, you're still here. I was a little worried there for a moment
July 30, 200917 yr Ah, you shouldn't be worried. I'm just worried about whoever added negative reputation to all of my posts that are clearly helpful. I'd understand if it was just the ones where I'm talking about harming myself, but the ones where I'm offering a good, helping hand deserve a positive rep, if anything, it's clearly abuse.
July 30, 200917 yr Author Ah, you shouldn't be worried. I'm just worried about whoever added negative reputation to all of my posts that are clearly helpful. I'd understand if it was just the ones where I'm talking about harming myself, but the ones where I'm offering a good, helping hand deserve a positive rep, if anything, it's clearly abuse. What if I click on the green ones, will that balance it out?!
July 30, 200917 yr It should do yes, I've reported it anyway, but don't give me a positive reputation just because of that, it has to be well earnt haha.
July 30, 200917 yr Author It should do yes, I've reported it anyway, but don't give me a positive reputation just because of that, it has to be well earnt haha. Well you did help, so I think you deserve them!!
Create an account or sign in to comment