Make input invisible through css?

Boris Callens picture Boris Callens · Jul 3, 2009 · Viewed 69.5k times · Source

I have a form where depending on the website's brand one of two input fields should be visible at one given spot.

I figured I just put both input fields in the same container and then through my stylesheet set one of them to display:none; This does hide the field, but it still makes it take up space. I also tried setting the height and width to 0 or setting visibility to hidden or collapse but none of those worked.

Untill now all the branding things could be done with css style sheets so I would like to keep it that way. The solution should at least be supported in IE6 & up, Firefox 2 & up and Chrome (latest).

Answer

bdo334 picture bdo334 · Jul 3, 2009

why don't you use input type="hidden" ?