How to set the (deprecated) valign attribute with JavaScript

by
, posted

Recently, I wanted to set the deprecated valign attribute using JavaScript. (I wouldn’t normally do this, but I was working on a code golfing challenge.)

Here’s how I did it:

// Reminder: this is deprecated!
myHtmlElement.vAlign = "bottom";

Again, this feature is deprecated. The vertical-align CSS property is a recommended alternative. Here’s how you’d do this the “right” way:

myHtmlElement.style.verticalAlign = "bottom";

I couldn’t find this documented anywhere, so I thought I’d write it up for the next person.