Here is the code I have a question about
.store {
display: block;
position: relative;
}
.store:before, .store:after {
display: block;
position:absolute;
content:'';
}
.store:before {
background: url(store-before.png);
height: 23px;
width: 54px;
top:-3px;
left:-3px;
}
.store:after {
background: url(store-after.png);
height: 20px;
width: 41px;
bottom:-3px;
right:-3px;
}
I noticed that when the "content" is anything besides two apostrophes, the before and after images don't show up. Can somebody explain the meaning of the two apostrophes? Thanks.
The two apostrophes denote a string. Two double quotes denote a string as well, which delimiter you use depends on preference and escaping needs; see here for all the details.
If there's nothing between the two string delimiters, either ''
or ""
, then you have an empty string. If you have anything besides a string, it's some other value which may or may not be valid. See here for all the possible values for content
. If you pass an invalid value, then like any other style declaration the browser will ignore it, and without any valid value content
will default to normal
, which is really none
for the :before
and :after
pseudo-elements. That will prevent your pseudo-element from displaying.