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:
01530929
Vues:
54
This message has been marked as a message which has helped to the initial question of the thread.
J'aime (1)
Naomi,

~ is an ASP.NET control specific feature and it doesn't work in plain HTML elements. If you have the CSS in an ASP.NET page you can use:
background-image: url(< % = ResolveUrl("~./images/load.gif") % >);
But that won't work in a CSS file because it's not served by an ASP.NET page.

In Css files any files are referenced with:
background-image: url(../images/load.gif);
Note the url() function.

More importantly though Url paths are relative to the CSS file (not the HTML page) which makes it relatively easy to reference an image folder in your app.

Note that you should rarely reference paths like /virtual/images/load.gif as these are effectively hardcoded. I'd recommend you always use relative paths inside of CSS.

+++ Rick ---

>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?
>
>Also, I want to display this info at the top
>
>My Application .....................Version ... Date
>
>By just using h1 tag the info is not shown as I want, all shown together. So, I assume I need to create a new class for the date, right? And what do I need to do for the version?
>
>Thanks in advance.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform