Answer by Arjan for Syntax: Use variable for css value
var textH = $(".Text").height();var vertAlign = ((140 - textH)/2);$(".Text").css({ margin-top: vertAlign +'px' });You need to specify the unit, otherwise your browser won't be able to tell whether you...
View ArticleAnswer by robx for Syntax: Use variable for css value
optionally if you'd like to do more than one style:var styles = {'margin-top':vertAlign,'property':100,'property':somevalue}$(".Text").css(styles);
View ArticleAnswer by Arman P. for Syntax: Use variable for css value
Remove quotes surrounding vertAlign$(".Text").css('margin-top', vertAlign);Try the above code. It must help you.
View ArticleSyntax: Use variable for css value
Trying to keep a box centered vertically within another box. I know there's css that can do this, but I'd rather use jquery, more reliable(?).var textH = $(".Text").height();var vertAlign = ((140 -...
View Article
More Pages to Explore .....