Announcement

Collapse
No announcement yet.

CSS problem with z-index

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    CSS problem with z-index

    I'm trying to add some images over the main product images with marketing messages like SALE or NEW etc. I figured the most flexible way would be to create some template images with coloured splashes and overlayed text messages and simply stack them using z-index and select the appropriate combination using a custom variable for each product.

    However, no matter what I try whenever I add the code to Actinic, the images follow one another in a column instead of overlaying as expected.

    The sample test code below works perfectly standalone so I presume this is a CSS problem in actinic.css but no idea what it might be - any ideas folks ?

    testcss.css ( I have added these lines to the main actinic.css file too )
    Code:
    #imagelayer { position:relative; z-index:9030;}
    
    #colourlayer { position:relative; top:-320; left:0; z-index:9040;}
    
    #textlayer { position:relative; top:-420; left:0; z-index:9050;}
    standalone .html test , proves concept works perfectly. But when inserting this into Actinic ( even in something as simple as a text fragment with the usual !!< >!! tags ) it gets interpretted as a column of images instead of overlaying them as expected.
    Code:
    <html>
    <head>
    <link rel="stylesheet" href="testcss.css">
    </head>
    <body>
    <p>
    <div id="imagelayer">
    <img src="product.jpg" width=200 height=320>
    </div>
    
    <div id="colourlayer">
    <img src="label_red.png" width=100 height=100>
    </div>
    
    
    <div id="textlayer">
    <img src="label_sale.png" width=100 height=100>
    
    </div>
    </p>
    </body>
    </html>

    #2
    It's most likely that some other CSS is taking precedence against the img tag and superceding your positioning CSS on the DIV.
    Without seeing the final, published HTML it is impossible to tell you exactly.
    You could possibly try attributing the img tag with the ID and assigning the CSS directly to the TAG rather than a surrounding div? e.g.
    Code:
    <img id="imagelayer" src="product.jpg" width=200 height=320> 
    <img id="colourlayer" src="label_red.png" width=100 height=100>
    <img id="textlayer" src="label_sale.png" width=100 height=100>
    Fergus Weir - teclan ltd
    Ecommerce Digital Marketing

    SellerDeck Responsive Web Design

    SellerDeck Hosting
    SellerDeck Digital Marketing

    Comment


      #3
      I really appreciate the help, I tried that too but even more surprisingly the images align horizontally instead.

      Ive published a simple template to illustrate it but the effect happens on any template so the cause must lay somewhere within the css file :

      webpage:
      test.html

      css:
      actinic.css


      UPDATE: Just copied the html and css to my laptop but it renders correctly so really stumped as to how to debug this.

      Comment


        #4
        If it's the vertical layout you want with the green "shunted up" 25% over the red one then try

        #textlayer {
        position: relative;
        top: -25px;
        z-index: 600;


        }

        If it's the horizontal version you need shunted to left then

        #textlayer {
        position: relative;
        left: -25px;
        z-index: 600;


        }
        Fergus Weir - teclan ltd
        Ecommerce Digital Marketing

        SellerDeck Responsive Web Design

        SellerDeck Hosting
        SellerDeck Digital Marketing

        Comment


          #5
          Fantastic - that works.

          So the 'px' bit is important then

          Comment

          Working...
          X