2013-10-09 105 views
1

我創建了PHP接受$ _GET方法數據的文件。PHP CSS ::內聯工作但不包括內部和外部樣式表

之後,我使用所有數據創建HTML頁面。數據沒有錯,但在CSS我不能設計HTML元素的樣式。除了內聯樣式外,該功能可行,但不適合維護。

我嘗試使用這樣的,但它不能正常工作,請幫助

預先感謝

使用example.php

<?php 
$dataCover  = $_GET['dataCover']; 
$dataTitle  = $_GET['dataTitle']; 
$dataTag  = $_GET['dataTag']; 
$dataDir  = $_GET['dataDir']; 
$dataYear  = $_GET['dataYear']; 
$dataCreated = $_GET['dataCreated']; 
$dataModified = $_GET['dataModified']; 
$userAUID  = $_GET['userAUID']; 
$galleryID  = $_GET['galleryID']; 
?> 

<!DOCTYPE html> 
<html> 
<head> 
    <title></title> 

    <style type="text/css" media="all"> 
     #container img{ 
      height: 230px; 
      width: 200px; 
     } 
     #container .center{ 
      display: block; 
      margin: 0 auto; 
     } 
    </style> 

    <script src="../lib/jquery-1.10.2.min.js"></script> 
    <script src="../lib/jquery.mobile-1.3.1.min.js"></script> 
    <script src="../lib/se.js"></script> 
</head> 

<body> 


    <div data-role ="page" id ="page1"> 
     <div data-role ="header"> 
      <h1> header </h1> 
     </div> 

     <div data-role="content"> 
      <div id="container"> 
       <img class="center" src="<?echo $dataCover?>" alt=""/> 
       <p id="title"><?echo $dataTitle;?></p> 
       <p id="tag"><?echo $dataTag;?></p> 
       <p id="created">Created : <?echo $dataCreated?></p> 
       <p id="modified">modified : <?echo $dataModified?></p> 
       <a href="http://54.249.251.55/AUgallery" target="_blank" data-url="<? echo $dataCreated ?>" rel="external" data-role="button">View Ebook-Gallery</a> 
       <a href="<?echo 'http://localhost/webAPP/php/addBookmark.php?userAUID='.$userAUID.'&noteID='.$galleryID?>"data-ajax="false" rel="external" data-role="button">Bookmark</a> 
      </div> 
     </div> 
    </div> 

</body> 
</html> 
+0

你的php和html是否在同一個文件中? – vishalkin

+0

是的,先生!?它在同一個文件中,但文件名是example.php –

+0

它對我使用外部css鏈接。 – vishalkin

回答

0

當您從移動你的CSS內聯到樣式表文件,您必須使用Ctrl + F5刷新頁面。也許它來自緩存。 你也可以通過jQuery將你的CSS分配給圖像。

0

我沒有看到任何外部樣式表的引用,所以你好像忘了這麼做。

把這一行

<link rel="stylesheet" type="text/css" href="/css/style.css" /> 

某處的頭部。也許在腳本標記之前。

確保您將路徑調整爲您的樣式表。

0
Yes When you want to apply external css you have to give the path after the <title> tags within the <head> tags .just follow the html code 
<!DOCTYPE html> 
<html> 
<head> 
    <title></title> 

    <link rel="stylesheet" type="text/css" href="css/style.css" /> 
<!--Here css is the folder name where you have keep the style.css file --> 

    <script src="../lib/jquery-1.10.2.min.js"></script> 
    <script src="../lib/jquery.mobile-1.3.1.min.js"></script> 
    <script src="../lib/se.js"></script> 
</head> 
相關問題