|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Binding external css to a page
Hello.
I appreciate your help very much, (the subject might or might not be directly replated to python(I realy don't know what's it related to)) Binding external css (the basic CSS1 standard) file to an html doesn't work. [ It does work if the styles definitions are embedded in the page itself ] I'm using apache on linux and I tried 2 browsers ( mozilla 1.5-3(debian) and konqueror 3.1.5 ) I'm using the very simple example which doesn't work #!/usr/bin/python print 'Content-Type: text/html\n\n' print '''<html> <head> <link href="jazzy.css" rel="stylesheet" type="text/css" /> </head> <body> <h1> hello </h1> </body> </html> ''' and the css file ( jazzy.css) looks like h1 {color: yellow; background: yellow; } p {margin-left: 20px} body {background: red; color:red } Both files are in the same virtual directory and both have full permissions(rw) for everyone. I Idon't have an idea what the problem is. Thanks a lot Roy |
|
#2
|
|||
|
|||
|
Are you running this as a CGI script?
I once had the same problem with a JPG. After tail'ing apache's error_log I noticed it was trying to execute the jpg as a script. You might have the same problem. Try placing the CSS in the root of your webserver and using <link href="/jazzy.css" rel="stylesheet" type="text/css" /> Best of luck! |
|
#3
|
||||
|
||||
|
I dont really see why Python/CGI in general could effect wether a style-sheet is linking to the page properly; one handy thing you can do when working like this is to check the pages source code to make sure everything is being outputted correctly.
Also, i can't help knowtice that your using xhtml but have no DTD at the top? You might also want to look at the Python section of this page for handeling Content-Type headers for XHTML: http://www.xml.com/pub/a/2003/03/19/dive-into-xml.html Mark. |
|
#4
|
|||
|
|||
|
Problem solved
thanks a lot guys.
The problem is that Apache is trying somehow to execute every file that is in it's virtual directory, therefore, files like jpg, css will not be showed properly ( and sometimes will write in the apache's error log file, that it's trying to execute....) , the solution is to move the files out of the apache virtual directory Mark, thanks for the remark, I had some trouble finding good documentation about how to use modules that can validate xml with dtd/ schema, but i'll keep on looking. ![]() |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > Binding external css to a page |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|