css - Please explain: content:''; -
here code have 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 when "content" besides 2 apostrophes, before , after images don't show up. can explain meaning of 2 apostrophes? thanks.
the 2 apostrophes denote string. 2 double quotes denote string well, delimiter use depends on preference , escaping needs; see here details.
if there's nothing between 2 string delimiters, either ''
or ""
, have empty string. if have besides string, it's other value may or may not valid. see here possible values content
. if pass invalid value, other style declaration browser ignore it, , without valid value content
default normal
, none
:before
, :after
pseudo-elements. prevent pseudo-element displaying.
Comments
Post a Comment