Forums

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

Home Forums CSS changing left value of centered div

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #253738
    Pranab
    Participant

    to center a div, we do trick like this,

    position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
    

    but if change the value of left or top like left: 60% or top: 40% , then it would be not so centered at all..then i’ll try to change the value in translate also to balance this..
    but not working..
    any idea?

    codepen – http://codepen.io/Phe0nix/pen/XRJaMJ

    #253739
    Shikkediel
    Participant

    The top and left values are in relation to the parent, the transform values are in relation to the element itself. Not sure what you’re trying to achieve.

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