Grow your CSS skills. Land your dream job.

Where I made a mistake with position:absolute

  • # October 3, 2012 at 4:47 pm

    Hi!

    I’m building a slider for my website, and I need to add buttons which will be above the content.

    But I’ve run into some strange issue (most likely it’s just my lack of knowledge).

    How it should look: http://codepen.io/anon/pen/ikcno (without buttons)
    As you can see elements have symmetric 20px margin on the left/right sides from the wrapper.

    But when I add buttons (with position:absolute) http://codepen.io/anon/pen/iFCyc

    Everything goes weird, I lost margin on the right and on the left margin becomes too large.

    How to properly add buttons? Thanks

    # October 3, 2012 at 5:11 pm

    I’m not 100% sure this is the solution but I just placed the left-arrow div above the right-arrow div in your HTML.

    http://codepen.io/anon/pen/jGLzg

    # October 3, 2012 at 5:17 pm

    Soren, I’m think this is the solution because this issue was probably caused by :first-child selector. Thanks.

    # October 3, 2012 at 5:22 pm

    :) no problems. only solutions.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".