i try to use css in my website's templates
i inserted the following statement under <head> in the template file
<link rel="stylesheet" type="text/css" href="home.css">
however, it is not work when preview
the css file is
<style> #banner {background: url(../image/topbannerhome.gif) no-repeat } </style>
If i inserted the following statements under <head> in the template file
<style type="text/css"> #banner {background: url(../image/topbannerhome.gif) no-repeat } </style>
then it is work
Can anyone help me to solve this problem?
i want to use css files in the templates
what should i do?
THANK YOU VERY MUCH
Using CSS in templates
Yep!
The CSS file should not have HTML tags in it.
Remove the <style> and </style> and all should work.
Using CSS in templates
i rewrited the css file to just only have the statement
#banner {background: url(../image/topbannerhome.gif) no-repeat }
but it still doesn't work
is there any problem of my codes?
Using CSS in templates
i put all the templates in a folder called Templates which is in the root folder
ie. ../root/Templates/home.dwt
but the css file is in the root folder not in the Templates folder
ie. ../root/home.css
and the home.jsp which use the home.dwt templates and the home.css is also in the root folder
ie. ../root/home.jsp
is there any problem?
the coding is the same as the above post
Using CSS in templates
Hi ocean,
It could be the path to your background image.
Is the image directory at the same level as root ?
Hope that helps
Using CSS in templates
The path of the image is correct
because i have inserted the whole css code in the jsp file
<style type="text/css"> #banner {background: url(../image/topbannerhome.gif) no-repeat } </style>
the image can be displayed
however, if i use css file, then it can't be displayed
is there any problem with my jsp file?
i copy the coding of the head of jsp file
<html> <head> <title> Home</title> <meta http-equiv="Content-Type" content="text/html; charset=big5"> <link rel="stylesheet" type="text/css" href="../css/home.css"> <script language="JavaScript" type="text/JavaScript">
Thank you very much
Using CSS in templates
Hi ocean,
It's possible your server hasn't got the mime type for CSS set up.
If the server is local do a search on google to find out how to add mime types for your server type.
Hope that helps
where are you linking from?
Are you typing the code directly into the template, or are you using DW to link to the CSS? Try deleting the link code then go "Text/CSS Styles" and choose "Attach Style Sheet" rather than typing the code in directly. Then save your template and see if the problem goes away.
Sometimes when you type the code in yourself DW doesn't update the pages correctly.