1.11M Members

Adding css to JSP

 
0
 

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

 
0
 

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

 
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

 
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)

 
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;
}
 
0
 

Can you please post the JSP file?

PS: Please use code tags here is small help

 
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>
 
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 6 Years Ago by peter_budo
 
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.

 
-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