2 回答

TA貢獻1804條經(jīng)驗 獲得超3個贊
您的模板文件和標題都有head標簽。這是無效的 HTML。你應該有兩個頭文件。
索引.php:
<html>
<head>
<title>Velo pour tous</title>
<link rel="stylesheet" type="text/css" href="css/app.css">
<?php
include 'templates/common/header-head.php'
?>
</head>
<body>
<?php
include 'templates/common/header-body.php'
?>
<!-- everything else -->
</body>
頭head.php:
<meta charset="utf-8">
<title>Velo pour tous</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../css/app.css">
<link rel="stylesheet" type="text/css" href="Projet tech web ratt/css/app.css">
header-body.php
<header>
<div class="main">
<div class="logo">
<img src="C:\wamp64\www\Projet tech web ratt\ressources\logo.png">
</div>
<ul>
<li class="active"><a href="#">Accueil</a></li>
<li><a href="file:///C:/Users/ab/Documents/test%20projet/Qui%20sommes%20nous.html">Qui-sommes nous ?</a></li>
<li><a href="file:///C:/Users/ab/Documents/test%20projet/ce%20que%20nous%20vus%20proposons.html">Ce que nous vous proposons</a></li>
<li><a href="file:///C:/Users/ab/Documents/test%20projet/login.html">Connexion</a></li>
<li><a href="file:///C:/Users/ab/Documents/test%20projet/contact.html">Contactez-nous</a></li>
</ul>
</div>
<hr>
</header>

TA貢獻1799條經(jīng)驗 獲得超6個贊
如果我理解正確,那么 header.php 應該是一個部分文件,對吧?CSS 資產(chǎn)應僅在您的索引文件中定義。
根據(jù)您的目錄結(jié)構(gòu),這應該有效:
由于頭文件與索引文件位于同一級別的目錄中,因此您可以簡單地引用為
templates/common/header.php
由于header.php中是將在主體注入的部分文件,你不應該重復的HTML標簽,如
<html>
,<head>
和<body>
。
索引.php
<html>
<head>
<title>Velo pour tous</title>
<link rel="stylesheet" type="text/css" href="css/app.css">
</head>
<body>
<?php include 'templates/common/header.php'; ?>
...
頭文件
<header>
<div class="main">
<div class="logo">
<!-- You should be able to reference your assets like this -->
<img src="ressources/logo.png">
</div>
<ul>
<li class="active"><a href="#">Accueil</a></li>
<!-- I intentially left out your file pointer because I don't know your directory structure for these -->
<li>...</li>
</ul>
</div>
<hr>
</header>
編輯
至于您在 CSS 中引用的圖像,我假設(shè)您的意思是videoblocks-group-of-young-happy-cyclists.png. 將這些事情考慮在內(nèi)會很有幫助,就好像您實際站在當前正在運行的文件中一樣。所以,如果你的目錄結(jié)構(gòu)是:
css/app.css
ressources/*
然后,在處理 CSS 文件時,您需要跳上 1 個目錄,然后進入該ressources目錄以引用圖像。
像這樣:
.image_quiSommesNous{
background-image:url(../ressources/videoblocks-group-of-young-happy-cyclists.png);
...
}
- 2 回答
- 0 關(guān)注
- 185 瀏覽
添加回答
舉報