CodeIgniter PHP样式表链接。怎么样? [英] CodeIgniter PHP stylesheet link. HOW?

查看:128
本文介绍了CodeIgniter PHP样式表链接。怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用xampp为我的php。我已经下载一个代码点火器,并保存在我的htdocs。我已经创建了一个数据库和一个示例页面。我唯一的问题是如何链接我的CSS。我应该在哪里保存我的style.css?如何调用我的style.css?

I'm using xampp for my php. And I have download a code igniter and save it on my htdocs. I already made a databasing and a sample page. My only problem is how can I link my css. Where should I save my style.css? How can I call my style.css?


<link rel="stylesheet" href="<? base_url(); ?>stylesheet/style.css" type="text/css" media="screen"/>

我有这个,但仍有问题。是否一步一步如何链接css?

I have this but still have a problem. Is there a step by step on how to link a css?

谢谢。

推荐答案

把你的CSS放在任何你想要的地方,然后定位那个url。

Put your CSS wherever you’d like, then target that url.

尝试将它放在/css/test.css文件夹中,例如'/'是您网站的根目录,而不是您的CI安装。

Try putting it in the folder ‘/css/test.css’ for instance ‘/’ being the root of your site, not your CI install.

然后可以用

<?= link_tag(base_url().'css/test.css'); ?>

这应该生成以下代码

<link href="http://yoursite.com/css/test.css" rel="stylesheet" type="text/css" />

如果您在CSS中遇到问题,最简单的方法来找出您的脚本在哪里尝试来调用它,是查看您的网页源代码输出。你会看到CI认为它在哪里。

If you’re having trouble targetin the CSS, the easiest way to find out where your script is trying to call it, is to look in your web pages source output. You’ll see exactly where CI thinks it’s located.

这篇关于CodeIgniter PHP样式表链接。怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆