content
is typically reserved for pseudo-elements like :before
and :after
.
It's recommended to use content
with pseudo elements like :after and :before.
(Source: CSS-Tricks)
Interestingly, it seems to work on regular elements too, but mainly in WebKit browsers such as Chrome and Safari.
Though designed for pseudo-elements, content
functions on WebKit browsers like Chrome and Safari.
(As noted by George Nava on CSS-Tricks)
Possible Solutions
Here are a few solutions:
Utilize :before
:
CSS:
div.clearearlanding:before {
content: url('/images/clearearlandingpage.png');
margin-left: -70px;
width: 120%;
}
Alternatively, use an img
tag (though you may have specific reasons not to):
CSS:
div.clearearlanding > img {
margin-left: -70px;
width: 120%;
}
HTML:
<div class="clearearlanding">
<img src="https://placeholdit.imgix.net/~text?txtsize=48&txt=512%C3%97256&w=512&h=256" />
</div>
Another option is to apply background-image
either on .clearearlanding
or its :before
element.