• Resolved theglovner

    (@theglovner)


    First time posting long time reader.

    Wondered if anyone can help me out with the following issue I’m having.

    I’m trying to use CSS Layers to build up a picture (in order to allow each of the portrait png’s to seperately clickable to link to other pages).

    I’ve set up a custom.css containing the following:

    .Layer-1 {
      position: relative;
      left: +0px;
      top: +0px;
      width: 1500px;
      height: 900px;
      z-index: 1;
    }
    
    .Layer-2 {
      position: relative;
      left: 36px;
      top: 23px;
      width: 236px;
      height: 355px;
      z-index: 2;
    }
    
    .Layer-3 {
      position: relative;
      left: 314px;
      top: 23px;
      width: 284px;
      height: 355px;
      z-index: 3;
    }
    
    .Layer-4 {
      position: relative;
      left: 636px;
      top: 23px;
      width: 284px;
      height: 355px;
      z-index: 4;
    }
    
    .Layer-5 {
      position: relative;
      left: 951px;
      top: 23px;
      width: 236px;
      height: 355px;
      z-index: 5;
    }

    I’ve then copied the standard full width template and added the following piece of code (so I only affect a single page, the one calling the copied .php):

    <div class="layer1">
        <img src="https://www.klones.co.uk/wp-content/uploads/2013/07/Layer-1.png">
    
               <div class="layer2">
               <img src="https://www.klones.co.uk/wp-content/uploads/2013/07/Layer-2.png">
    
                      <div class="layer3">
                      <img src="https://www.klones.co.uk/wp-content/uploads/2013/07/Layer-3.png">
    
                            <div class="layer4">
                            <img src="https://www.klones.co.uk/wp-content/uploads/2013/07/Layer-4.png">
    
                                  <div class="layer5">
                                  <img src="https://www.klones.co.uk/wp-content/uploads/2013/07/Layer-5.png">
        			      </div>
    			</div>
    		  </div>
    	   </div>
        </div>

    My expectation given everything I’ve read over the past two hours trying to work this out would have led me to believe I would end up with something like:

    https://www.klones.co.uk/wp-content/uploads/2013/07/Layer-0.png

    But what I’m actually seeing is this:

    https://www.klones.co.uk/sandbox/

    I’d appreciate any help anyone can give.

    Thanks for looking.

Viewing 15 replies - 1 through 15 (of 23 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Can you go with this sort of HTML structure instead:

    <div class="layer one">
     ...
    </div>
    <div class="layer two">
     ...
    </div>
    <div class="layer three">
     ...
    </div>
    <div class="layer four">
     ...
    </div>

    ?

    Then you can just float the guys left as demonstrated here https://cssdesk.com/feumk .

    Use # instead of .

    Additionally, in most cases CSS classes are not case sensitive, but you may want to capitalize the L in the code just in case.

    Thread Starter theglovner

    (@theglovner)

    Afraid you’ve lost me, apologies all I know has been learned from google so far, so parts of the theory and jargon are a bit foreign to me.

    What you’ve suggested certainly appears to get the images side by side which is an improvement. But I was looking to get some space between each one.

    Other problem is, your example drops the main background image (black background with the band logo and instructions to click each of the above pictures.

    Apologies if I’m missing something obvious.

    No don’t go that route. Basically, the styling you’ve set up is not being called properly.

    Use #Layer1 instead of .Layer1

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I was only addressing your HTML layout.

    For CSS spacing, see this tutorial: https://www.w3schools.com/css/css_margin.asp

    Other problem is, your example drops the main background image

    What do you mean, “drops”?
    Anyway, I assume you can just move your main background image below your four guys (in HTML) to get it below it.

    Thread Starter theglovner

    (@theglovner)

    Tried the changes you’ve suggested:

    php code is now:

    <div class="Layer-1">
        <img src="https://www.klones.co.uk/wp-content/uploads/2013/07/Layer-1.png">
    
    .....etc

    CSS now:

    #Layer-1 {
      position: relative;
      left: +0px;
      top: +0px;
      width: 1500px;
      height: 900px;
      z-index: 1;
    }
    .....etc

    Doesn’t seem to have made any change though:

    https://www.klones.co.uk/sandbox/

    (Out of curiosity why # instead of .?)

    Thread Starter theglovner

    (@theglovner)

    Sorry Andrew.

    Drops as in, the example you provided didn’t have the background image in it so I wasn’t sure how that was supposed to be placed behind the rest of the images (i.e. was I on the right track with the z-index).

    According to your sandbox, the div class your calling is still “layer1”, not “Layer-1”

    Make them match EXACTLY the same. If you did and the site isn’t updating, that means you have either a cache plugin or a plugin that’s causing the site to cache.

    And you can probably change the # back to .

    Thread Starter theglovner

    (@theglovner)

    I do have a cache plugin, I’ll clear it now and see what happens.

    Thanks for your help.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I updated that CSSdesk page if you’re interested.

    Thread Starter theglovner

    (@theglovner)

    I am interested in anything that might make this work. Spent most of the day trying to get it working.

    Had a look at the CSSdesk page and that is exactly the result I’m looking for.

    Tried porting the code over to my pages and purged the cache but again no change. Still shows the images vertically one after each other.

    Could it possibly be something to do with the rest of the code in the php file that’s throwing it off? Since it certainly has the intended result when you show it on CSSDesk.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Where are you putting the CSS?

    Thread Starter theglovner

    (@theglovner)

    Into a custom.css that I created so I didn’t mess up any of the code that comes with the theme.

    Main css for the theme had this at the top:

    */
    /*
    WARNING! DO NOT EDIT THIS FILE!
    
    To make it easy to update your theme, you should not edit the styles in this file. Instead use
    the custom.css file to add your styles. You can copy a style from this file and paste it in
    custom.css and it will override the style in this file. You have been warned! :)

    Although those styles aren’t new versions of existing ones, they are completely new.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Try putting this in that custom.css file:

    body {
     border: 10px solid red;
    }

    Does that appear?

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘CSS Image Layers’ is closed to new replies.