【发布时间】:2018-08-15 21:58:51
【问题描述】:
我不明白为什么我的 css 不会链接到 html 文件。如代码段所示,我已经尝试了在线示例,但是这两个选项都不起作用。当我在浏览器中加载 localhost 文件夹时,html 页面肯定会显示为文本“root-container”。任何帮助都会很棒!
尝试在链接之前添加“应用程序”似乎也没有什么不同。例如。 'application/assets/style/navigation.css'。
此外,帮助程序和 url 已添加到自动加载配置文件中。
基本网址
$config['base_url'] = 'http://localhost/mysite/';
项目结构
省略根文件夹。假设根文件夹名称为“mysite”。所以 mysite -> 应用程序 -> ...
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset = "utf-8">
<link rel="stylesheet" type = "text/css" href="<?php echo
base_url('application/assets/style/navigation.css')?>">
<link rel = "stylesheet" type = "text/css" href = "<?php echo
base_url(); ?>assets/style/navigation.css">
<?php echo link_tag('assets/style/navigation.css'); ?>
</head>
<body>
<div class = "root-container">
root-container
</div>
</body>
</html>
CSS
html {
margin: 0 auto;
padding: 0px;
}
body {
margin: 0 auto;
padding: 0px;
}
.root-container {
width:100%;
height:60px;
border-bottom: 2px solid grey;
background-color: black;
color: red;
}
.root-container p {
color:red;
text-decoration: line-through;
}
添加请求的图片
结果 文本应该是红色的,并且有线条穿过它。
【问题讨论】:
标签: html css codeigniter