Forums

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

Home Forums CSS [Solved] Vertically Align One Image over Other (Responsive)

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #178693
    tahirk
    Participant

    Hi,

    I’m working on creating a quiz (where users can select/deselect images by clicking over it).

    Currently, I’m having issues with aligning the Checked image over the already available image. I want the checked image to appear at exact center (vertically/horizontally) and must also be responsive. I’ve tried quite a few things but it won’t get at exact center.

    Any help in this regard is highly appreciated.

    Here is the pen.

    #178698
    tahirk
    Participant

    Currently, I haven’t implemented that. At first, I want to make sure that the checked icon is exactly aligned.

    We could also do test check by changing the opacity: 0 to opacity:1 of .quizimgblock a .check.

    From:
    .quizimgblock a .check {
      opacity: 0;
    
    To:
    .quizimgblock a .check {
      opacity: 1;
    #178699
    Paulie_D
    Member

    There’s a lot of stuff going on in the Codepen so it’s hard to be overly specific but, in general this will work.

    Item to be centered

    
      position: absolute;
      top: 50%; /* half way down */
      left:50%;  /* halfway over */
      -webkit-transform:translate(-50%, -50%); /* move it back 50% of it's own width & height */
    

    http://codepen.io/Paulie-D/pen/xbltq

    #178738
    tahirk
    Participant

    Thanks for the help. Yes, it did helped a lot. The problem I have is that I’ll be using a fixed size CHECKED image for selecting the images and the the images to be selected are completely responsive, so I do think that we can’t have an absolute fix for this and the current one does seems to work fine until we hit less than 360px screen.

    Here is the pen.

    #178743
    tahirk
    Participant

    Thanks Soronbe. Yes, I’m controlling it with media quires but still we can’t be perfect with it as we are using one image with fixed width/height, although it would be changing through media queries but that’ll be a jump and not completely according to the responsive image.

    Never the less, I’ve got the result which is more than acceptable, and the difference isn’t bad on smaller screen, checked image appears a bit on down side.

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