Prev | Current Page 273 | Next

Craig Grannell

"The Essential Guide to CSS and HTML Web Design"


USING LINKS AND CREATING NAVIGATION
191
5
Enhancing accessibility for collapsible content
Although the old version of the Images from Iceland site looks good, it has a problem in
common with the previous exercise: when JavaScript is disabled, the initially hidden content
is inaccessible. The Iceland site was quickly knocked together a number of years back
and has been superseded with a new site, but for any site developed today, there should
be no excuses.
In the previous exercise, the hidden content is set to be hidden by default and the display
property is toggled via the JavaScript function. What therefore needs to be done is to
make the content visible by default and then override this, making it invisible, but only if
the user has JavaScript. The first thing to do is remove the style attribute from the following
line of code: