including .css files

I hope this is the right forum for this message. I have a .css file, which has some styling. I would like to include this file as is in a jsp page.

I can include it using the LINK tag, but then, when I save this page the .css file will be saved in a separate directory, which is not required. All the styling should be saved when the page saves.

I can always go and put the contents of the .css file within the STYLE tag, but I wanted to know whether there is another way for me to just include this .css file within the STYLE tag, or just include this .css file, so that its contents would be taken...

@import is not working. A response would be great. I hope I conveyed my situation correctly.

When you link the CSS file in a page it should be relative to the page location. For example, I keep all my CSS stuff in one folder called CSS. My link tag looks like
<link rel="stylesheet" type="text/css" href="CSS/style.css">
from my homepage. I could just as well have the css file in my home directory, but I like it to be a bit more organized. I know BWD is probably the CSS expert, maybe he can elaborate on what you need to do.

I guess I'm having trouble following what you’re trying to accomplish. My understanding is that the .css files are meant to replace the <style> tags. so if you want everything formatted in the same manner you'd put it in the css file and you use the <style> tag for those instances that may not occur very often or something you wanted to format uniquely.

It's not a command to set up a hyperlink on your page... it's what tells your page where to find the .css file... the url part of it is telling the page where the file is located... not make a link that somebody can click on.

You don't use the style tag. You don't need the style tag. The .css is your style. That's why you are using a .css file... so you don't have to use style tags. You replace the style tags in the head with the code to get the .css file.

It's not a command to set up a hyperlink on your page... it's what tells your page where to find the .css file... the url part of it is telling the page where the file is located... not make a link that somebody can click on.

You don't use the style tag. You don't need the style tag. The .css is your style. That's why you are using a .css file... so you don't have to use style tags. You replace the style tags in the head with the code to get the .css file.

Click to expand...

Thanks for the reply.

Instead of using the contents of the .css , can i just include the .css file, like an import statement in java.

I don't think you can. Even working with jsp there is a lot of HTML coding and for the css to do its work properly it will have to be included in the whole page,between the head tags, not just the javascript. @import is a java command, not an html one.

I don't think you can. Even working with jsp there is a lot of HTML coding and for the css to do its work properly it will have to be included in the whole page,between the head tags, not just the javascript. @import is a java command, not an html one.

Click to expand...

Thanks for the reply.

So I need to put in all the code from the .css file into the <style> </style > tag, am I right?.

you can't use the <style> </style> tags either. you have to use the <link tag to call up the file. don't think of that tag as putting in a hyperlink. that's not what it's doing. It's calling up the .css file to do it's work is all.