使用PHP的“ echo”'“创建元素时,样式无效

时间:2019-04-27 22:15:45

标签: php css

我使用PHP代码在另一个PHP文件中插入一些元素,而这些元素最初是在调用PHP文件样式内部创建的,但效果很好,但是当我用'include(somephpfile.php)'替换代码时,元素以我想要的方式添加,但样式不适用。

样式不适用于以这种方式创建的元素:

echo '<div class="col-lg-3 col-md-6 col-sm-6 col-xs-12">
<div class="wow fadeInLeft animated portfolio-item" data-wow-duration="500ms" data-wow-delay="0ms" style="box-shadow: 0px 10px 12px grey; width:80%">
          <div class="img-wrapper">
            <img src="booksCovers/';
    $queryImage = "SELECT cover from books where bookno = '$temp';";
    $resultsImage = mysqli_query($db, $queryImage);
    $imagesrc = mysqli_fetch_array($resultsImage);
    echo $imagesrc[0];
    echo '" class="img-responsive" alt="this is a title" style="width : 450px ; height :320px; " />
            <div class="mybooks-overlay">
              <div class="desc">
                <div class="description">';
    $query2 = "SELECT description FROM books WHERE bookno = '$temp';";
    $results = mysqli_query($db, $query2);
    $book = mysqli_fetch_array($results);
    echo $book[0];
    echo '
                </div>
                <a class="details" target="_blank " href=" #">Learn More</a>
              </div>
            </div>
          </div>
          <figcaption>



            <button class="myButtone">
              <div class="insider"> </div>
              20. 00$
            </button>


            <div class="heart"></div>

          </figcaption>
        </div>
        </div>';

但它通过以下方式适用:

<div class="col-lg-3 col-md-6 col-sm-6 col-xs-12">
        <div class="wow fadeInLeft animated portfolio-item" data-wow-duration="500ms" data-wow-delay="0ms" style="box-shadow: 0px 10px 12px grey; width:80%">
          <div class="img-wrapper">
            <img src="booksCovers/" class="img-responsive" alt="this is a title" style="width : 450px ; height :320px; " />
            <div class="mybooks-overlay">
              <div class="desc">
                <div class="description">
</div>             
              </div>
            </div>
          </div>
          <figcaption>



            <button class="myButtone">
              <div class="insider"> </div>
              20. 00$
            </button>


            <div class="heart"></div>

          </figcaption>
        </div>
        </div>

0 个答案:

没有答案