CodeIgniter PHP 样式表链接.如何? [英] CodeIgniter PHP stylesheet link. HOW?

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

问题描述

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

<前><link rel="样式表";href="

我有这个,但仍然有问题.是否有关于如何链接 css 的分步说明?

谢谢.

解决方案

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

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

从 CI 开始,你可以用

调用它

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

应该会生成以下代码

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

如果您在定位 CSS 时遇到问题,找出您的脚本试图调用它的位置的最简单方法是查看您的网页源输出.您将准确地看到 CI 认为它所在的位置.

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"/>

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

Thank You.

解决方案

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

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

From CI, you can then call it with

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

That should generate the following code

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

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天全站免登陆