Hi, I've got a website online here: Sexy Footballers and I want to be able to add a box to either side of my page, which stays put, whilst the person scrolls up/down on any of the pages of my website. I'm just wondering, is this possible? Would it be very hard? And how would it be done? I've uploaded an image below of what I hope it would look like... Thanks for any help!
It is posible. Just put the box style "position: fixed". Example: <style> .box{ position: fixed } </style> <div class="box"> Advert image </div>
Thanks s_ruben, I've done this but its not quite in the right position. The text "advert" is right in the top left corner of the page, and although it is fixed I would like it to be in the center of the sidebar, if possible (like in the screenshot above). Thanks again for the help!
Try it: <style> .box{ position: fixed margin-left: 100px; margin-top: 200px; } </style> <div class="box"> Advert image </div> You can change the position by changing margin-left and margin-top pixels.
Thanks again s_ruben, and sorry got one final problem. I can get the text to appear on the left hand column, but can't seem to get it to appear on the right hand column. I think its just a case of knowing where to paste this code: <div class="box2"> <p>Advert image</p> </div> Thanks for any more help!
You're not putting any padding on the right hand box are you? That could cause the text to not show up if too much padding is applied. Also, that code should be pasted after the main content div of your website, assuming that the main content is centered. (I'm at school, can't pull the site up.)
Paste it just after <div class="box"> Advert image </div> so write after it <style> .box2{ position: fixed margin-left: 700px; margin-top: 200px; } </style> <div class="box2"> Advert image </div> and change the position by changing margin-left and margin-top pixels.
Hi guys, thanks for trying to help again. Nope, still can't get it to show up, even when removing all of the padding (I thought it might have been showing off the page) but I just can't seem to get it to show on the opposite side to the first advert image text. I've uploaded the changes to the Sexy Footballers site, but removed the code below because I can't get it showing in the right place. <div class="box2"> <p>Advert image</p> </div> Thanks for any more help offered
Anybody able to help? I can give them the code on my site if you need it or anything like that... Thanks to anyone who tries helping
Probably the z-index could bring them up front: .box{ z-index: 100; text-align: center; position: fixed; margin-left: 100px; margin-top: 200px; background-color:green; width:100px; height:100px; } .box2{ z-index:100; text-align: center; position: fixed; margin-right: 100px; margin-top: 200px; background-color:blue; width:100px; height:100px; } PHP: Also, declare box and box div container right after <body> tag: ... <body> <div class="box"> <p>Advert image</p> </div> <div class="box2"> <p>Advert image2</p> </div> <div id="wrap"> ... PHP: