Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] Fixed Positioning not working in Chrome

  • This topic is empty.
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #144778
    gmeikncc.1701
    Participant

    So I’m coding a tumblr theme for my friend: I do the code, she does the art assets. It was progressing along fine and turning out mostly glitch-free in firefox, so I figured I’d show her how it was coming along. She’s using chrome and it showed up to be a glitchy pile of dung in her browser window. I opened the site in chrome and sure enough, it was a glitchy pile of dung. Again, my code was working fine in FF! But wait, it gets stranger! My simple and sub par tumblog which also uses lots of fixed positioning, is working fine in chrome! (I coded the majority of this blog the day before yesterday) What could I be doing wrong? Here is the glitchy blog and I’ve included the code for the fixed elements below. #word{
    z-index:1;
    position:fixed;
    border-top:2px dotted white;
    width:120%;
    margin-left:-2px;
    padding:5px;
    }
    #topbar{
    width:120%;
    background-image: url(“http://i.imgur.com/rexW3uh.png”);
    margin:-8px;
    height:112px;
    opacity:0.25;
    z-index:-1;
    position:fixed;

    }
    #behind{
    width:120%;
    margin:-8px;
    height:112px;
    opacity:1;
    z-index:-4;
    background-color:#272727;
    position:fixed;
    }

    #linkbar{
    background-color:#272727;
    height:38px;
    width:120%;
    border-top:2px solid #2d2d2d;
    border-bottom:1px solid #121212;
    margin-left:-23px;
    position:fixed;
    text-align:center;
    margin-top:78px;
    box-shadow: 5px 5px 20px #121212;
    }

    #link-text{
    position:absolute; 
    top:50%;  
    margin-top:-5px;
    }
    

    and the html

    <div>   </div>
    <div></div>
    <div>&lt;behind&gt;</div>
    <div>
    <div>embed code for music player</div></div>
    

    thank you so much for your help!

    #144800
    dgriesel
    Participant

    looks fine for me in FF and Chrome, except the fixed background is scrolling with the page in Chrome.

    #144842
    gmeikncc.1701
    Participant

    Yeah! that’s the problem, mostly. The background and the topbar should be fixed, with the blog content scrolling behind, as it is in firefox. My question is: why would position:fixed work in FF but not Chrome? And why is it specific to this code, when something I just wrote used fixed positioning fine in chrome! it’s so weird!

    #144849
    Paulie_D
    Member

    Without going through the entire code it seems that you have a whole bunch of positioning going on.

    Surely the only thing that needs positioning is a single element (the nav bar) and you just put everything in that that you want to stay still.

    #144861
    gmeikncc.1701
    Participant

    Okay, I’ll try it! This doesn’t fix the fairly obvious problem of the background-attachment, though, which also isn’t working.

    #144862
    gmeikncc.1701
    Participant

    UPDATE:
    Using -webkit-transform: translateZ(0); worked for other elements, but I’m still stumped about background-attachment, which still doesn’t work. is there any way to apply -webkit-transform: translateZ(0); to a background?

    #144869
    Paulie_D
    Member

    I’m not sure what the heck is going on with your HTML…you seem to have invented a whole bunch of new elements.

    #144883
    gmeikncc.1701
    Participant

    I’m new to this and self-taught: I assumed that I could name divs whateverthecrap I wanted as long as it matched what I have in my css.

    #144884
    gmeikncc.1701
    Participant

    And including everything in one fixed div is just making weird stuff happen without fixing the main problem: that position:fixed was doing absolutely nothing in webkit browsers. Regardless of my weird html, everything is working fine except for the background-attachment:fixed property is also not working in webkit browsers and elsewhere on the internet isn’t helping me with that.

    #144885
    Paulie_D
    Member

    I’m new to this and self-taught: I assumed that I could name divs whateverthecrap I wanted as long as it matched what I have in my css.

    Clearly you were wrong.

    #144886
    Paulie_D
    Member
    <topbar>   </topbar>
    <word></word>
    <behind></behind>
    <linkbar><link-text></link-text></linkbar>
    
    #144887
    gmeikncc.1701
    Participant

    HAhahahaha Paulie_D I guess that’s not true since it’s working! I used code for fullsized background images by Chris Coyier. However, since position:fixed isn’t working for me in chrome, I used -webkit-transform: translateZ(0), but this overrode the z-index, so I also included -webkit-transform: translate3d(0px, 0px, 0px), and now everything is working a-okay in all major browsers (but I haven’t checked ie, I’ll ask my friend to later so I don’t have to install the beast)

    I will not be visiting this forum again. I was able to solve my problem on my own and received little more than snarky comments from the users of this site. Your replies were devoid of constructive criticism or substantial advice, and as a serial n00b I can say that making people feel stupid without teaching them how to better themselves is a good way to discourage them from developing their skills in any area

    #173657
    sunnykgupta
    Participant

    Trust me, you should not form an opinion of the world after meeting a single rude guy.

    You were right all along, try having a look at the discussion here: http://stackoverflow.com/q/6164000/1477051

    Some will try and guide you to solutions, while others (old-school) will try to tie you up with standards. (set by them)

    I’m sure you are way ahead in your HTML knowledge now. :)

    #188228
    cauli
    Participant

    For everyone searching for a solution to this problem:

    This just happened to me, I solved it by removing any 3D transforms from the parent of the div you want fixed (mine was a completely unnecessary “-webkit-transform: translateZ(-1000px);” in the <body> tag).

    Elements probably get fixed to the 3D element instead of fixing itself to the viewport (browser window) when the body is transformed.

    On the custom tags discussion: http://www.html5rocks.com/en/tutorials/webcomponents/customelements/

Viewing 14 posts - 1 through 14 (of 14 total)
  • The forum ‘CSS’ is closed to new topics and replies.