1

我创建了接受来自 $_GET 方法的数据的PHP文件。

之后,我使用获得的所有数据来创建 HTML 页面。数据没有问题,但在CSS中我无法设置 HTML 元素的样式。除非涉及内联样式,否则它可以工作,但不好维护。

我尝试这样使用,但它不起作用,请帮助

预先感谢

例子.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>
4

3 回答 3

0

当您将 css 从内联文件移动到样式表文件时,您必须使用 Ctrl+F5 刷新页面。也许它来自缓存。您也可以通过 jquery 将您的 css 分配给图像。

于 2013-11-07T12:10:10.513 回答
0

我没有看到对任何外部样式表的任何引用,因此您似乎忘记了这样做。

把这条线

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

头部某处。也许在脚本标签之前。

确保调整样式表的路径。

于 2013-11-07T12:15:33.057 回答
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>
于 2013-12-09T05:28:30.580 回答