how image can be vertically centralized in browser in any resolution.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pawan kumar Ray
    New Member
    • Feb 2011
    • 1

    how image can be vertically centralized in browser in any resolution.

    Please if find any one...
  • Ashwani Sharma
    New Member
    • Nov 2008
    • 46

    #2
    I've static solution for this, means if you know the size of your image which you want to centralized. suppose your image size is 200px, you can use this css:

    .abc{
    position:absolu te;
    float:left;
    height:200px;
    top:50%;
    margin-top:-100px;
    }

    this will work for your problem if there is static images but if the images will come dynamically then you have to use this same css calculation using JS or any other development tool.

    Regards,
    Ashwani Sharma

    Comment

    • NetDynamic
      New Member
      • Feb 2011
      • 27

      #3
      or just div it with margin:auto;

      for a background just add:

      background-attachment:fixe d;
      background-position:center ;

      Comment

      • Markus Igeland
        New Member
        • Feb 2011
        • 14

        #4
        NetDynamic: That's the best solution for centering something horizontal, and doesn't work when you want to center something vertically.

        Comment

        Working...