I am a beginner in programming and in the use of expressionengine, I don't understand why my CSS desn't work, I explain:
-in first, I intented to make a template for it, in html tags, but unsuccessfully
-in second, I intented to make it with a snippet, with the same method, unsuccessfully too
-at least, I did it whith a snippet but with a css's file's link, and it work but only with my index's template's group
thank you for answer to a noob in programming
Best wishes, seb.
Thank you for having answered,
of course I can, this is what is there in my snippet "header":
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1 /DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Metamorphosis Design Free Css Templates</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="css/styles.css" rel="stylesheet" type="text/css" media="all"/>
</head>
<body>
thank you for the time you passe on my request, thanks à lot.
yes, it work, thank you very much florian^^^^.
the relative path was wrong because the road was not where it was,
I used the first way FortySeven Media, it lacked a level of the tree
thanks a lot for all every body
sounds like a linking issue. make sure your path to the url file works from all templates..
I usually do something like this
<link rel="stylesheet" href="{site_url}css/style.css?v=2">
Then I create a folder on the ftp called 'css' and I upload my css file there.
You could put the line into to a snippet and include that with all your templates ..
Check to make sure that you're linking to stylesheets correctly in your templates.
If your CSS is an ExpressionEngine template:
<link href="{stylesheet=template_group/template_name}" media="all" />
If your CSS is a file on your server:
<link href="{path=/css/screen.css}" media="all" />
If your CSS is a Snippet or Global Variable:
<link href="{snippet_name}" media="all" />
Which method you choose is up to you, though each approach has advantages and disadvantages (which are out of the scope for this discussion).
What's happening is that without telling it specifically where to look it will try to look in the current directory. So if you were at site.com/page it would be looking in the page directory for the CSS file.
Like florian said, either using
{site_url}css/style.css?v=2
or just adding a slash at the front should make it always look to the root first.
/css/style.css?v=2
This might not be it, but a common issue: When you create a template in EE, EE serves that template using the exact name you set, with no file extension.
So, if you created css/style, but you're referencing css/style.css, you'll run into problems. Make sure that your template name includes the file extension.
in fact, I used an extension file as you said Doug with the syntax wich florian gave me and now it works very well
thanks a lot everybody