Simply give an id
of showcity
to the div element, then use :target
pseudo-class to make it visible:
<div id="showcity" class="city">Some city</div>
.city:target {
display: block;
}
6.6.2. The target pseudo-class :target
Some URIs refer to a location within a resource. This kind of URI ends
with a "number sign" (#) followed by an anchor identifier (called the
fragment identifier).
URIs with fragment identifiers link to a certain element within the
document, known as the target element. For instance, here is a URI
pointing to an anchor named section_2
in an HTML document:
http://example.com/html/top.html#section_2
A target element can be represented by the :target pseudo-class. If
the document's URI has no fragment identifier, then the document has
no target element.
It's worth noting that :target
is supported in IE9+.