2

If I use css code directly inside of the html code it works.If I use by linking css file inside of the html by tag it is not working.But I tried with ffox viewsource and link for css redirects to the perfect CSS.Please enlight me in this Case.Thanks in Advance.

CSS(POStyle.css) File included like this in HTML :

 <link href="$contextpath/css/yes/POStyle.css" rel="stylesheet" type="text/css"></link>

POStyle.css has

.popupCSS td, .popupCSS td
    {
         border:1px solid black;
         background-color:#EAF2FB;
         color : red;
    }

CSS inside the html directly :

<style type="text/css">
.popupCSS td, .popupCSS td
    {
         border:1px solid black;
         background-color:#EAF2FB;
         color : red;
    }   
</style>    
3
  • $contextpath may be smarty variable Commented Jan 9, 2014 at 10:54
  • What's $contextpath's value? Commented Jan 9, 2014 at 10:59
  • no problem with contextpath value it works.problem with the html only .Because from view source and click on the link it goes to the real css file. Commented Jan 9, 2014 at 11:02

2 Answers 2

1

When using:

<link href="$contextpath/css/yes/POStyle.css" rel="stylesheet" type="text/css"></link>

The browser uses the string literal $contextpath/css/yes/POStyle.css to request the CSS file. There is no replacement that occurs as you would expect in JSP files or some other view technology.

You must use either an absolute or relative url to the file:

Relative

<link href="../css/yes/POStyle.css" rel="stylesheet" type="text/css"></link>

Absolute

<link href="http:/www.mydomain.com/context/css/yes/POStyle.css" rel="stylesheet" type="text/css"></link>

Sign up to request clarification or add additional context in comments.

1 Comment

I tried by all these things but nothing works contextpath come perfectly no problem with that.even after giving full path like this no use <link href="localhost:8080/rdn_yes_splitchg/css/yes/POStyle.css" rel="stylesheet" type="text/css"></link>
0

Use {$contextpath} instead of $contextpath. It is a smarty variable.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.