在表达式引擎2.2.2中;我的 css 不能在所有地方都工作,为什么?

发布于 2024-12-05 10:53:13 字数 978 浏览 0 评论 0原文

我是编程和表达式引擎使用的初学者,我不明白为什么我的CSS desn不起作用,我解释一下:

-in 首先,我打算在html标签中为其制作一个模板,但没有成功

-in其次,我打算用一个片段来制作它,用同样的方法,但也没有成功

——至少,我用一个片段但是用了一个css文件的链接来做到这一点,它可以工作,但只能与我的索引模板一起使用 好运

感谢您对编程菜鸟的回答 祝您

,seb。

感谢您的回答,

我当然可以,这就是我的片段“标题”中的内容:

<!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>

感谢您花时间满足我的请求,非常感谢。

是的,它有效,非常感谢弗洛里安^^^^。


相对路径是错误的,因为道路不在原来的位置,

我使用了第一种方式 FortySeven Media,它缺少树的级别,

非常感谢大家

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

一梦等七年七年为一梦 2024-12-12 10:53:13

听起来像是一个链接问题。确保您的 url 文件路径适用于所有模板。

我通常会这样做

<link rel="stylesheet" href="{site_url}css/style.css?v=2">

然后我在 ftp 上创建一个名为“css”的文件夹,然后在那里上传我的 css 文件。

您可以将该行放入一个片段中,并将其包含在所有模板中..

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 ..

绿萝 2024-12-12 10:53:13

检查并确保您在模板中正确链接到样式表

如果您的 CSS 是 ExpressionEngine 模板:

<link href="{stylesheet=template_group/template_name}" media="all" />

如果您的 CSS 是服务器上的文件:

<link href="{path=/css/screen.css}" media="all" />

如果您的 CSS 是 Snippet全局变量

<link href="{snippet_name}" media="all" />

您选择哪种方法取决于您到尽管每种方法都有优点和缺点(这超出了本次讨论的范围)。

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).

季末如歌 2024-12-12 10:53:13

发生的情况是,在没有具体告诉它去哪里查找的情况下,它会尝试在当前目录中查找。因此,如果您访问 site.com/page,它将在页面目录中查找 CSS 文件。

就像弗洛里安说的那样,无论是使用

{site_url}css/style.css?v=2 

还是仅在前面添加斜杠都应该使其始终首先查看根。

/css/style.css?v=2 

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 
濫情▎り 2024-12-12 10:53:13

这可能不是这样,而是一个常见问题:当您在 EE 中创建模板时,EE 使用您设置的确切名称(没有文件扩展名)提供该模板。

因此,如果您创建了 css/style,但引用了 css/style.css,则会遇到问题。确保您的模板名称包含文件扩展名。

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.

深居我梦 2024-12-12 10:53:13

事实上,正如你所说,我使用了一个扩展文件,道格使用了弗洛里安给我的语法,现在它工作得很好,

非常感谢大家

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文