Click to See Complete Forum and Search --> : javascript value for inline-block


jacen6678
09-03-2004, 02:43 PM
I want to use a javascript to change the css display property of div elements from none to inline-block.

I am successfully using the syntax:
document.getElementById( 'id' ).style.display = 'none';

but the following do not work:
document.getElementById( 'id' ).style.display = "inline-block";
document.getElementById( 'id' ).style.display = 'inlineBlock';
document.getElementById( 'id' ).style.display = 'inline-block';

What is the javascript version of the inline-block value for the display property?

Paul Jr
09-03-2004, 02:53 PM
There is no such value "inline-block" for the display property. Information on the display property (http://www.w3.org/TR/REC-CSS2/visuren.html#propdef-display)

Stephen Philbin
09-03-2004, 03:00 PM
You can have inline or block but an element cant be both.

toicontien
09-03-2004, 09:00 PM
Originally posted by Mr Herer
You can have inline or block but an element cant be both.
Actually inline-block is a part of CSS 2.1: http://www.w3.org/TR/2003/WD-CSS21-20030915/visuren.html#display-prop

From W3.org: inline-block This value causes an element to generate a block box, which itself is flowed as a single inline box, similar to a replaced element. The inside of an inline-block is formatted as a block box, and the element itself is formatted as a replaced element on the line.

I can imagine that conforming browsers would use "inlineBlock," as most multi-word, hyphenated CSS properties and values are converted to interCase format in JavaScript.

Paul Jr
09-03-2004, 09:42 PM
Originally posted by toicontien
Actually inline-block is a part of CSS 2.1: http://www.w3.org/TR/2003/WD-CSS21-20030915/visuren.html#display-prop

Whoa, I guess I missed that. I sit corrected.