繁体   English   中英

style.css不适用于PHP文件(不能重复)

[英]style.css not applying to PHP file (not a repeat)

样式表未链接到PHP页面。 尝试了所有操作,包括添加您将在下面看到的meta标记,检查文件位置,但似乎没有任何方法可以解决问题。

这是profile.php文件:

 <?php 
include("includes/header.php");
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8"></meta>
<title>My title</title>
<link href="css/style.css" media="screen" rel="stylesheet" type="text/css" />
</head>

<?php

if(isset($_GET['profile_username'])){
    $username = $_GET['profile_username'];
    $user_details_query = mysqli_query($conn, "SELECT * FROM users WHERE username='$username'");
    $user_array = mysqli_fetch_array($user_details_query);

    $num_friends = (substr_count($user_array['friend_array'], ",")) - 1;
}

?>

    <div class="profile_left">
        <img src="<?php echo $user_array['profile_pic']; ?>">
    </div>

    <div class="profile_info">
        <p><?php echo "Posts: " . $user_array['num_posts']; ?></p>
        <p><?php echo "Likes: " . $user_array['num_likes']; ?></p>
        <p><?php echo "Friends: " . $num_friends ?></p>

    <div class="main_column column">
        <?php echo $username; ?> This is a profile page.
    </div>



    </div> <!-- closes wrapper from header.php-->
</body>
</html>

应该应用的style.css类:

  .profile_left {
    top: -10px;
    width: 17%;
    max-width: 240px;
    min-width: 130px;
    height: 100%;
    float: left;
    position: relative;
    background-color: #37b0e9;
    border-right: 10px solid #83d6fe;
    color: #cbeaf8;
    margin-right: 20px;
}

文件层次结构如下:

在此处输入图片说明

试试下面的代码

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM