Visibility Property

The visibility property can be used to show or hide elements. You should note that if you set the visibility property to invisible, the element still occupies the space on the page. If you want to make an element invisible and not take up space on the page, use the display property and set the value to none. The visibility property can be assigned the following values: visible (default), hidden, collapse (for tables only), and inherit. Some browsers do not support collapse or inherit. You should only use this property if you are trying to hide an element and still allow it to occupy the space on the page.

Display Property

The display property is very flexible and is a great tool in the CSS toolbox. There are many values that can be assigned to this property. However, the most common values are inline and block. This is because we can use these two values to change some of the element’s default display behavior. For example, some HTML elements are of type: block such as headings, paragraphs, and divs. Other HTML elements such as span and anchor are inline. We can easily change the behavior of an inline element to act as a block element by using this property. You should note that changing the display type of an element changes only how the element is displayed, not what kind of element it is. For example, an inline element set to display:block is not allowed to have block elements nested within it. Here is a listing of the possible values you can specify for the display property. Not all of the values are supported by all of the browsers. The values inline-table, table, table-caption, table-cell, table-column, table-column-group, table-row, table-row-group, and inherit are not supported in Internet Explorer 7 and earlier. Internet Explorer 8 requires a !DOCTYPE specified in the HTML document. Internet Explorer 9 does support the values.