1,105,229 Community Members

Adding css to JSP

Member Avatar
jeetudaljit
Newbie Poster
16 posts since Jul 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Please let me know how to add css to a jsp page?

Member Avatar
peter_budo
Code tags enforcer
7,933 posts since Dec 2004
Reputation Points: 2,502 [?]
Q&As Helped to Solve: 1,028 [?]
Skill Endorsements: 66 [?]
Moderator
Featured
 
0
 

Exactly as to any other HTML based document, either use internal or external approach.

Member Avatar
jeetudaljit
Newbie Poster
16 posts since Jul 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Exactly as to any other HTML based document, either use internal or external approach.

i used ....
<LINK href="style1.css" rel="stylesheet" type="text/css">


in <head> tags but it did't work. Plz help

Member Avatar
peter_budo
Code tags enforcer
7,933 posts since Dec 2004
Reputation Points: 2,502 [?]
Q&As Helped to Solve: 1,028 [?]
Skill Endorsements: 66 [?]
Moderator
Featured
 
0
 

Incorrect order of tag elements, it should be as

<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>

also make sure their are in correct directory (in your case together with JSP document)

Member Avatar
jeetudaljit
Newbie Poster
16 posts since Jul 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

yes, I have rechecked. . Both files are in same directory.

here is css file

root { 
    display: block;
    font-size: 14px;
  font-style: italic;
  font-weight: normal;
  font-variant: normal;
  color: navy;
  background-color: #ccffcc;
  background-attachment: none;
  font-family: Georgia,'Times New Roman',times,serif;
}
Member Avatar
peter_budo
Code tags enforcer
7,933 posts since Dec 2004
Reputation Points: 2,502 [?]
Q&As Helped to Solve: 1,028 [?]
Skill Endorsements: 66 [?]
Moderator
Featured
 
0
 

Can you please post the JSP file?

PS: Please use code tags here is small help

Member Avatar
jeetudaljit
Newbie Poster
16 posts since Jul 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 
<html>
    <head>
          
          <LINK href="style1.css" rel="stylesheet" type="text/css">
       
        <title>JSP Page</title>
    </head>
    <body>
        
        <form>
         <h2>Hello World!</h2>
    </form>

    </body>
</html>
Member Avatar
peter_budo
Code tags enforcer
7,933 posts since Dec 2004
Reputation Points: 2,502 [?]
Q&As Helped to Solve: 1,028 [?]
Skill Endorsements: 66 [?]
Moderator
Featured
 
0
 

Just did little bit of search on internet and seems to me there is more trouble with use of the root then you want to go through. Just replace it with html or html,body

Question Answered as of 5 Years Ago by peter_budo
Member Avatar
jeetudaljit
Newbie Poster
16 posts since Jul 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi Peter.. This problem is solved as I made following changes in jsp
..

<form>
            <root>
            Welcome... To this style1.       
 </root></form>

Thanks a lot for ur help.

Member Avatar
shahpraneel
Newbie Poster
1 post since Apr 2010
Reputation Points: -2 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
-1
 

you can add the following things inside the <head> tag

<meta http-equiv="Content-Style-Type" content="text/css">
<title> Home </title>
<html:base/>
<link HREF="../theme/screens.css" REL="stylesheet" TYPE="text/css" >
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article