Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Vertically Center With Jquery

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
9,895
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jul 6, 2008

This lesson, I'll show you how you can vertically center elements or images by using just a bit of jQuery (javascript library). For more tips and tutorials, please visit www.detachedesigns.com/blog

Category:

Howto & Style

Tags:

License:

Standard YouTube License

  • likes, 2 dislikes

Link to this comment:

Share to:
see all

All Comments (10)

Sign In or Sign Up now to post a comment!
  • On my channel i've got a tutorial on how to do this with just HTML and CSS

  • @selecto16 You can't do that dude everyone doesn't have the same pixel aspect ratio

  • Thanks! 

  • @selecto16

    you meant: margin-top: -200px ;)

  • You dont neen jQuery to vertically position an element; you can do it with CSS, this way:

    position:absolute;

    width:500px;

    height:400px;

    margin-left:-250px;

    margin-top:200px;

    top:50%;

    left:50%

    There you go. The margin is halp of the width/height, in negative ;-)

  • if you want me to give you proper JQuery Tutorials (easy to follow and suitable for any one) Message me with a subject: JQuery and message: yes

  • nice video's very usefull! but please make sure your next vids are of better quality

  • Nice trick Jeffrey Jordan Way but will this work on a scrolling page? i.e. will the image remain vertically centered even if we scroll up n down the page ?

  • Nice! I like how everything is so easy with jQuery.

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more