P粉5026087992023-08-17 14:03:56
try:
<style type="text/css"> .on-the-fly-behavior { background-image: url('particular_ad.png'); } @media screen and (max-width: 300px) { /* 添加screen and */ .on-the-fly-behavior { background-image: url('particular_ad_small.png'); } } </style>
P粉2141766392023-08-17 12:38:07
In a .cshtml file, you cannot use it directly because it will be treated as a class or object. When you need to add content starting with @
in an html file, you need to add an additional @
. Try using the following code:
<style type="text/css"> .on-the-fly-behavior { background-image: url('particular_ad.png'); } @@media (max-width: 300px) { .on-the-fly-behavior { background-image: url('particular_ad_small.png'); } } </style>