Forum: Rails Spinoffs (closed, excessive spam) Unable to get style property

57564570dcbfeb09e90c3fb913a7daf4?d=identicon&s=25 mocambo (Guest)
on 2008-07-06 06:52
(Received via mailing list)
.css file contains:

.scrollbox_content {
  padding: 5px
}

.js contains:

var content_div = document.createElement('div');
content_div.addClassName('scrollbox_content');
element.insert(this.content_div);

This "padding" is now visible but

$$('.scrollbox_content')[0].getStyle('padding')

gives "".
57564570dcbfeb09e90c3fb913a7daf4?d=identicon&s=25 mocambo (Guest)
on 2008-07-06 06:59
(Received via mailing list)
In my previous message was an typo, so my question once again:

.css file contains:

.scrollbox_content {
        padding: 5px

}

.js contains:

var content_div = document.createElement('div');
content_div.addClassName('scrollbox_content');
element.insert(content_div);

This "padding" is now visible but

$$('.scrollbox_content')[0].getStyle('padding')

gives "".
F1fcf834ddad415f60d29c87cc10d4d4?d=identicon&s=25 kangax (Guest)
on 2008-07-06 18:36
(Received via mailing list)
Try:

parseFloat($$('.scrollbox_content')[0].getStyle('paddingLeft'), 10);

-- kangax
57564570dcbfeb09e90c3fb913a7daf4?d=identicon&s=25 mocambo (Guest)
on 2008-07-06 21:42
(Received via mailing list)
Element.getstyle() reads element style values. And the current values
are:

$$('.scrollbox_content')[0].style.padding = "";
$$('.scrollbox_content')[0].style.paddingLeft = "";
$$('.scrollbox_content')[0].style.paddingTop = "";
$$('.scrollbox_content')[0].style.paddingBottom = "";
$$('.scrollbox_content')[0].style.paddingRight = "";

But browser shows 5px padding anyway. How to get these paddings ?
57564570dcbfeb09e90c3fb913a7daf4?d=identicon&s=25 mocambo (Guest)
on 2008-07-06 23:16
(Received via mailing list)
Kangax, you were right ... getStyle returns values for 'paddingTop',
'paddingRight', 'paddingLeft', 'paddingBottom'.
This topic is locked and can not be replied to.