How do I set the padding-top based on height of a div in JQuery or Javascript?

Hey guys so I have a product site and each product's div's height is different based on the info entered.

I need a div I have that is position: absolute with a padding-top:58em; to have the padding-top automatically fill in based on the height of the one div that contains all the product info. I am not to sure on how to do this so if you guys could help I would appreciate :)

Hope this makes sense, if not please let me know!


Is your intention to calculate the padding-top to make sure all of your content is lined up at the bottom? For example, are you looking to do this: ?

If this is what you're looking for, rather than setting the padding-top programmatically you can just set the following attributes (assuming the container div has a fixed height already set):

#parent {
    display: table;

#child {
     display: table-cell;
     vertical-align: bottom;

I hope this is what you were looking for!

Need Your Help

Blurry UILabel when added programatically

ios ios5 uilabel blurry

I am adding a UILabel to a view meant for loading purposes. However, it gets blurry after I added it.

Ruby on Rails gem to make passwords more secure?

ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.2 passwords password-protection

I built a Ruby on Rails authentication system from scratch and it works great.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.