I added a ‘map’ class to a Rails image_tag helper like this
<%= image_tag "http://maps.google.com/maps/api/staticmap?size=300x200&sensor=false&zoom=16&markers={{ latitude }}%2C{{ longitude }}", :class => "map" %>
I tried to set styles specific to that image with the map class, so that the image wouldn’t be visible by default:
img {
border: solid 0px black;
}
img .map { visibility: hidden
}
However, the map class image is visible by default
The ‘map’ class is visible in the html.
<img alt="Staticmap?size=300x200&sensor=false&zoom=16&markers=40.6891947%2c-74.0444169" class="map" src="http://maps.google.com/maps/api/staticmap?size=300x200&sensor=false&zoom=16&markers=40.6891947%2C-74.0444169">
When I inspect the element, Chrome console shows that its only the styles from img that are registering, not img .map
Can you see what I might be doing wrong?
Your CSS should say
With the space it is the CSS element element selector. It selects elements inside elements. You are looking to use the class selector.