/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$(document).ready(function() { var max = 0; $("label").each(function(){ if ($(this).width() > max) max = $(this).width(); }); $("label").width(max); }); //CSS label, input[type="text"]{ float:left; display:block; } label { margin-right: 5px; } .field{ width:100%; overflow:auto; margin:5px 0px; }
URL: http://www.jankoatwarpspeed.com/post/2008/07/09/Justify-elements-using-jQuery-and-CSS.aspx