我不明白为什么我的css不会链接到html文件。我在网上试过代码段中所示的示例,但两个选项都不起作用。当我在浏览器中加载localhost文件夹时,html页面肯定显示为文本“根容器”。任何帮助都很好!
在链接之前尝试添加“application”似乎也没什么区别。E、 g.“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>
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;
}
添加请求的图像
结果