Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Few CSS questions
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01530195
Message ID:
01530877
Vues:
45
This message has been marked as a message which has helped to the initial question of the thread.
>Hi everybody,
>
>In ASP.NET MVC project I added an image in Images folder (I created that folder). I'm trying to do this in the site.css
>
>h1 {
>    font-size: 2em;
>    padding-bottom: 0;
>    margin-bottom: 0;
>    background-image: '~/Images/ChangeInfo.jpg';
>}
>
>However, I don't see my image at all. Do I reference this image correctly?
>

No. The ~ tilde reference only works inside particular places of the code, not in the CSS page. It's basically a shortcut for ASP.NET to tell it to resolve the URL at runtime. CSS/CSS files aren't evaluated by ASP.NET at runtime.

The path for the image is referenced relative to the current "folder" you are in. So normally you'll use an absolute path here: background-image: '/Images/ChangeInfo.jpg' so that the image works regardless of what the current path is.
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform