[英]CodeIgniter CSS will not link to html
我不知道為什么我的CSS不會鏈接到html文件。 我已經在線嘗試了示例,如代碼段所示,但是這兩個選項都不起作用。 當我在瀏覽器中加載localhost文件夾時,html頁面肯定顯示為文本“ root-container”。 任何幫助將是巨大的!
嘗試在鏈接之前添加“應用程序”似乎也沒有什么不同。 例如“應用程序/資產/樣式/navigation.css”。
另外,helper和url已添加到自動加載配置文件中。
基本網址
$config['base_url'] = 'http://localhost/mysite/';
項目結構
省略根文件夾。 假設根文件夾名稱為“ mysite”。 所以mysite-> application-> ...
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;
}
添加請求的圖像
結果文本應為紅色,並在其中划過一行。
okey,您將資產文件移動到主目錄,然后將application / assets / style / navigation.css編輯到資產/style/navigation.css
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.