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.

How do I Make an <img> appear below a CSS background image of a <div>?

Featured Replies

Hi there...

 

I have a <div> tag with a CSS background image. This background image is repeatable so that when the user adds more content the background carries on beneath.

 

To make the page consistent and give it a better look I also have a bottom part to the background. This bottom part is an <img> within the <div> - at the bottom...obviously.

 

At the moment the <div>'s CSS background image is showing below the <img>. Is there a trick so that the <img> appears below the CSS background?

 

Here's the code and an image of what I'm trying to do...

 

<div id="content">

     <h1>Friendly Harpenden based service for Home and Home Office PC's and Laptops</h1>

 <ul>
           <li>Home visits</li>
           <li>No call out charge</li>
           <li>No fix, no fee</li>
           <li>Free local collection and delivery within 15 miles of Harpenden</li>
           <li>Over 15 years experience</li>
           <li>Please click <a href="services.html" title="Click to go to Services Page">'Services'</a> tab above for full list of services offered</li>
       </ul>


       <img id="content_box_bottom" src="images/content_3_bottom.png" />

</div>

post-17166-126597603794_thumb.jpg

Hi,

you want <img id="content_box_bottom" src="images/content_3_bottom.png" /> outside of the content div. You might find that there will be a small gap between where the content container ends and where the content_box_bottom container starts so a bit of negative margin-top should sort you out.

 

Hope that helps

  • Author

....so a bit of negative margin-top should sort you out.

 

Hope that helps

 

 

That's the one! I couldn't figure out how to get rid of that negative space by placing it outside the <div>....thanks!

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.