Style CSS ne s'affiche pas pour un include

hexoseth -  
 hexoseth -
Bonjour,

J'ai créer un template avec un menu intégré grace a la fonction include
mais le menu ne suis pas le contenu du css.

voila la structure

index.php

<head>
<link href="templates/css/template_css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php include "templates/index.php"; ?>
</body>


templates/index.php

<td width="100%" height="29px"> <?php include "include/menu.inc.php" ?> </td>


template_css.css

#menu li {
display : inline;
font-size : 20px;
font-weight : bold;
}



Normalement le menu devrait être a l'horizontal et la taille de la police de 20px.

Est ce que les styles passe aussi sur les fichiers intégré avec include?
Merci
A voir également:

3 réponses

Reivax962 Messages postés 3742 Statut Membre 1 011
 
Bonjour,

1 - Oui bien sûr, la feuille de style est appliquée par le navigateur, qui ne "sait" pas si un bout de code vient d'un include ou pas, puisqu'il ne reçoit que le code généré au final par php.

2 - "include/menu.inc.php" : peut-on voir à quoi il ressemble ?

3 - La page générée, justement, celle que tu vois en faisant "afficher la source" quand tu as ta page affichée dans ton navigateur, elle ressemble à quoi ?

Xavier
0
freddux Messages postés 2 Statut Membre
 
Le source de ton document HTML généré donne quoi ?
freddux.
0
hexoseth
 
le code source de la page généré index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>

<title></title> <!-- variable titre_page -->

<meta name="keywords" lang="fr" content="" /> <!-- variable mot_cle -->
<meta name="description" content="Description de ma page web." /> <!-- variable description -->

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="fr" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />

<link href="templates/css/template_css.css" rel="stylesheet" type="text/css" /> <!-- mettre une variable pour le fichier css utiliser par le template en cours. nom variable : file_css -->
<link rel="shortcut icon" href="" />
</head>
<body>
<div>

<a name="up" id="up"></a>

<table width="100%" height="20px" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" class="mt"> <a href="http://hexoseth.online.fr" >hexoseth.online.fr</a> </td>
</tr>
</table>

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>
<td> <img src="/images/space.gif" width="770px" height="1px" /> </td>
</tr>
<tr>
<td> <div class="background">
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="/images/center.jpg">
<tr>

<td width="26px"> <img src="/images/left.jpg" width="26px" /> </td>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="100px" colspan="2px" class="title" style="padding-top:14px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" style="padding-left:10px;"> <a href="" title=""></a>HS Pc - Hardware & Software </td>

<td>banner</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="400px" height="29px"> <div id="search">XXXXXX</div> </td>

<td width="100%" height="29px"> <div id="menu"><ul>
<li><a href="">Accueil</a></li>
<li><a href="">News</a></li>
<li><a href="">Hardware</a></li>
<li><a href="">Software</a></li>
<li><a href="">Downloads</a></li>

<li><a href="">Contact</a></li>
<li><a href="ftp://hexoseth.serveftp.org" class="prive">Accès Privé</a></li>
</ul></div> </td>
</tr>
</table></td>
<td width="26px"><img src="/images/right.jpg" width="26px" /></td>
</tr>

</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="11px" height="25px" background="/images/shadowl.jpg"><div>
</div></td>
<td height="25px" bgcolor="#F1F1F1" style="border-bottom: 1px solid #999999; border-top: 5px solid #FFFFFF;">PathWay</td>
<td height="25px" align="right" bgcolor="#F1F1F1" style="border-bottom: 1px solid #999999; border-top: 5px solid #FFFFFF;"><div class="date">69 visiteurs 27-02-2008</div></td>

<td width="11px" height="25px" align="right" background="/images/shadowr.jpg"> </td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" style="padding-left:8px; background-repeat: repeat-y;" background="/images/shadowl.jpg"> </td>
<td valign="top" style="background-repeat: repeat-y;"background="/images/lb.gif">
<div class="leftrow">
menu gauche
</div>

</td>
<td valign="top" bgcolor="#FAFAFA" width="100%"><div class"main">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top" bgcolor="#F1F1F1">
<td colspan="3px" style="border-top: 3px solid #FFFFFF;">
<div id="info_client">
Votre IP : 192.168.0.254. Première visite le 26-02-2008 17:53:41, vous étiez le 64 ème visiteurs. </div>

</td>
</tr>
<tr>
<td valign="top" bgcolor="#F1F1F1" style="border-top: 3px solid #FFFFFF;"> <div> <p> Description page</p> </div> </td>
<td width="4px" valign="top" bgcolor="#FFFFFF" style="border-top: 3px solid #FFFFFF;"> <div> </div> </td>
<td valign="top" bgcolor="#F1F1F1" style="border-top: 3px solid #FFFFFF;"> <div> 2 </div> </td>

</tr>
<tr align="left" valign="top">
<td colspan="3px" style=" border-top: 4px solid #FFFFFF; padding: 5px;"><div class="main">

Bonjour,<br>
<br>
Désolé le site est momentanément indisponible. Je suis actuellement en train de modifier la présentation et le fonctionnement du site.
<br>

Merci de votre compréhention.

</div></td>
</tr>
<tr bgcolor="#F1F1F1">
<td colspan="3px" valign="top" style="border-top: 3px solid #FFFFFF;">
<div>
bas
</div>
</td>
</tr>

</table>
</td>
<td valign="top" style="background-repeat: repeat-y; "background="/images/rb.gif">
<div class="rightrow">
droite pub ou autre
</div>
</td>
<td valign="top" style="padding-right: 8px; background-repeat: repeat-y;" background="/images/shadowr.jpg"> </td>
</tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0" background="/images/center2.jpg">
<tr>
<td width="26px"><img src="/images/left2.jpg" /></td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="30px" align="left"><a href=""><img src="/images/ltop.jpg" alt="Top!" border="0" /></a> </td>
<td align="center"><div class="footer">

<a href="https://mamboteam.com/" target="_blank">Design by Mamboteam.com!</a></div>
</td>
<td width="30px" align="right"><a href=""><img src="/images/rtop.jpg" alt="Top!" border="0" /></a></td>
</tr>
</table></td>
<td width="26px"><img src="/images/right2.jpg" /></td>
</tr>
</table>

</div></td>
</tr>
</table>
</div>
<p>
<a href="http://validator.w3.org/check?uri=referer"><img
src="http://www.w3.org/Icons/valid-xhtml10"
alt="Valid XHTML 1.0 Strict" height="31" width="88" border="0" /></a>
</p>
</body>
</html>



le fichier include menu.inc.php

<ul>
<li><a href="">Accueil</a></li>
<li><a href="">News</a></li>
<li><a href="">Hardware</a></li>
<li><a href="">Software</a></li>
<li><a href="">Downloads</a></li>
<li><a href="">Contact</a></li>
<li><a href="ftp://hexoseth.serveftp.org" class="prive">Accès Privé</a></li>
</ul>
0
Reivax962 Messages postés 3742 Statut Membre 1 011
 
C'est bizarre...
Quand je copie-colle ton code dans un bloc-note, j'obtiens un truc bizarre :
<div id="menu?">

au lieu de
<div id="menu">

Et si je supprime ce "?", tout fonctionne !

Il doit y avoir un caractère bizarre qui se cache dans cette ligne, chez toi.

Je ne peux que te conseiller de supprimer id="menu"> et de le retaper à la main.

Xavier
0
hexoseth
 
non c'est bon j'ai trouver. en faite c'est une erreur de ma part, j'avais défini deux fois un style pour mon menu liste et c'était le dernier qui était pris en compte. je l'ai supprimer et tout est rentré dans l'ordre. J'aurai du y pensé avant, je suis un peu fatigué en ce moment. Bon je repart dans mes ligne de code pour mon site.

Merci quand même.
0