Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Positioning of Background images

Featured Replies

I'm a scratching my head a little bit here!

 

I'm trying to recreate this home page by stripping out the Flash elements for mobile and replacing them with CSS driven elements. I've turned to background images and using pseudos to create a rollover effect. To do this I need to create three different "panels". But the problem is, when I add the images to the page, they stack together right on top of each other rather than side by side the way it is currently which pushes down the flash element below even further.

 

You try and position each of the panels into place using relative positioning and it does the job with an annoying side effect. As far as the HTML is concerned, the divs are still placed in the same position so the space is still taken up as if the elements haven't been applied for CSS.

 

The only way I can position the panels as desired is to actually enclose the the CSS backgrounds in tables, which I know is not good practice and not what I want to end up doign in the long term. Is there a solution that I'm missing? :/

 

<style id = "" type = "text/css">
#valetingPanel {
 position: relative;
 width: 286px;
 height: 330px;
 background-image:url(images/p_valeting.png); }

#detailPanel {
 position: relative;
 width: 286px;
 /*left: 300px;
 top: -330px;*/
 height: 330px;
 background-image:url(images/p_detailing.png);
}

#carpetPanel {
 /**/
 position: relative;
 width: 286px;
 /*left: 600px;
 top: -660px;*/
 height: 330px;
 background-image:url(images/p_carpets.png);
}

#valetingPanel:hover,
#detailPanel:hover,
#carpetPanel:hover /**/ {
 background-position: -300px;
}

#panels {

 position: relative;
 left: 40px;
 width: 1000px;
 vertical-align:middle;
 text-align:center;

}/**/

/*object#FlashID2 {
 position: absolute;
 top: -200px;
}*/
</style>
	 <div id = "panels">

	 <table> <!-- tables Arrrgh -->
	 <tr>
	 <td>
	 <div id = "valetingPanel"> </div></td>
	 <td>
	 <div id = "detailPanel"> </div></td>
	 <td>
	 <div id = "carpetPanel"> </div></td>
	 </tr>
	 </table>
	 </div>

Have you tried to use float: left; and float: right; ???? Seems the simplest way to do it then add a margin??

 

So:

 

<style id = "" type = "text/css">

#valetingPanel {

position: relative;

float: left;

width: 286px;

height: 330px;

background-image:url(images/p_valeting.png); }

 

#detailPanel {

position: relative;

width: 286px;

float: left;

/*left: 300px;

top: -330px;*/

height: 330px;

background-image:url(images/p_detailing.png);

}

 

#carpetPanel {

/**/

position: relative;

width: 286px;

float: right;

/*left: 600px;

top: -660px;*/

height: 330px;

background-image:url(images/p_carpets.png);

}

 

#valetingPanel:hover,

#detailPanel:hover,

#carpetPanel:hover /**/ {

background-position: -300px;

}

 

#panels {

 

position: relative;

left: 40px;

width: 1000px;

vertical-align:middle;

text-align:center;

 

}/**/

 

/*object#FlashID2 {

position: absolute;

top: -200px;

}*/

</style>

<div id = "panels">

<div id = "valetingPanel"> </div>

<div id = "detailPanel"> </div>

<div id = "carpetPanel"> </div>

</div>

haha thats ok mate, sometimes the simplest of solutions escape us all some time!

 

I remember one of my first sites and I was testing it to make sure all functionality was there and was getting annoyed why the contact from wouldnt send. Rebuilt my php code 3 times to make sure there was nothing wrong. Then after 4 hours realised the php wont work and send email unless the site is on a live server lol!

  • Author

haha I always underestimate my capacity to miss the obvious, goes with the territory for my brain. ;) That's why I love doing this for myself.

The obvious is always where you look last. You start exploring the more technical side of things as it has more chance to mess up until you realise it was something so simple. Just helped a mate do some yahoo log in thing because his developers couldnt get it working. It was real simple, the file name was wrong so yahoo couldnt verify it. Im no expert but I see the obvious very easily sometimes lol!

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.