Using the display Property to Change an Elementâs Flow
The CSS display
property
reliably accepts a range of values corresponding to the flow
types explained previously, as well as none
. The resulting behavior produces a range of
desirable effects, all of which are demonstrated on this bookâs
companion site:
Primary navigation links on âbrochureâ sites most often assume a horizontal orientation. This is done by changing the
display
value of their constituent list items toblock
(resolving an ambiguity in the HTML Document Type Definitions) and applying a number of other layout properties, particularlyfloat
. In tandem with assigningdisplay: block
to hyperlinks, this solution is preferred to applying#nav li { display: inline; }
in situations where navigation link footprints need to be equally or statically sized.Once given a
display
value ofblock
, links can be assigned arbitrarywidth
andheight
values, which makes them easier to compose within a web application interface. This technique can also be used to increase their footprint, putting into practice the principle of human-computer interaction (HCI) known as Fittsâs Law. This asserts that larger interface objects are easier to activate with a pointer device than smaller ones.The manner in which ordered and unordered lists are normally arranged with respect to their neighbors can be altered, so that they can be presented serially within other copy.
By changing the
display
value of form controls toblock
, it becomes possible ...
Get HTML & CSS: The Good Parts now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.