Ross Sharp
Ross Sharp

Reputation: 1

CSS/HTML/PHP CSS not being applied to HTML

I'm not very good at website developing but as this is my graded unit and im trying to make it nice.

Im running into an issue with HTML and CSS (possibly PHP as well?) where it is not being applied when im using classes.

Things ive tried so far: Put the CSS through w3schools error checks - Clean Directly linking the CSS in the admin.php instead of through the seperate header - No effect Directly applying the css is style tags (Tried inputting 'style"color:white;"' into both the thead and table tags) - No effect I am using bottstrap for easier styling so maybe this is overpowering the CSS? My stylesheet is being called after though so this "shouldn't" be the case.

admin.php (the file i want the css to be applied to):

<?php
require 'header.php';
?>
 <br><br><br>

    <table class="aT">
    <thead class="aTH">
        <td>Member Number</td>
        <td>Username</td>
        <td>Forename(s)</td>
        <td>Surname</td>
        <td>Email</td>
        <td>Date Of Birth</td>
        <td>Age</td>
        <td>User Type (1 = admin, 2 = Verified Seller, 3 = Unverified Seller)</td>
        <td>Phone number</td>
    </thead>
<?php
    $result = mysqli_query($link, "SELECT userid, username, forenames, surname, email, dob, age, usergroup, phonenumber FROM members");
    while($row = mysqli_fetch_array($result)) {
    ?>

    <tbody>
        <tr>
            <td id="memberno" contenteditable="true"><?php echo $row['userid']?></td>
            <td id="username" contenteditable="true"><?php echo $row['username']?></td>
            <td id="dob" contenteditable="true"><?php echo $row['forenames']?></td>
            <td id="salutation" contenteditable="true"><?php echo $row['surname']?></td>
            <td id="forenames" contenteditable="true"><?php echo $row['email']?></td>
            <td id="surname" contenteditable="false"><?php echo $row['dob']?></td>
            <td id="email" contenteditable="false"><?php echo $row['age']?></td>
            <td id="user_type" contenteditable="true"><?php echo $row['usergroup']?></td>
            <td id="user_type" contenteditable="false"><?php echo $row['phonenumber']?></td>
        </tr>

    <?php
    }
?>
</tbody>

<?php
include 'footer.php';
?>

header.php:

<!doctype html>
<html>
<?php
require 'mysqli.php';
?>
<head>
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

    <!-- Optional theme -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

    <!-- Latest compiled and minified JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

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

    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <a class="navbar-brand" href="index.php">Ross's Rides</a>
        </div>
        <ul class="nav navbar-nav">
          <li class="active"><a href="index.php">Home</a></li>
          <li><a href="buysell.php">Buy/Sell</a></li>
        </ul>
        <?php
          if(!isset($_SESSION)) 
            { 
                session_start(); 
            } 
          if (!isset($_SESSION["admin"]) && !isset($_SESSION["user"]) && !isset($_SESSION["useru"])) {
              ?>
            <form method="get" action="login.php" class="btn_1">
            <a class="btn btn_2 navbar-btn" href="login.php">Login/Register</a>
            </form>
            <?php 
          }
          else {
              ?>
            <form method="get" action="logout.php" class="btn_1">
            <a class="btn btn_2 navbar-btn" href="logout.php">Logout</a>
            </form> 
            <?php
          }
          if (isset($_SESSION["admin"])) {
              ?>
            <form method="get" action="admin.php" class="btn_1">
            <a class="btn btn_2 navbar-btn" href="admin.php">Admin Panel</a>
            </form>
            <?php
          }
        ?>
      </div>
    </nav>
</head>

stylesheet.css:

.btn_1 {
    display:inline;
    float: right;
}

.btn_2 {
    background-color: black;
    border-radius: 25px;
    padding: 10px 10px;
    color: white;
}

.loginBox {
    padding-top: 100px;
}

.submitBtn {
    background-color: black;
    border-radius: 25px;
    padding: 10px 25px;
    color: white;
}

.cancelBtn {
    background-color: black;
    border-radius: 25px;
    padding: 10px 25px;
    color: white;
}

.registerForm {
    padding-top: 40px;
}

.redText {
    color: red;
}

.aT {
    width: 100%;
    border: 1px;
    border: thick;
    border-color: limegreen;
    padding: 10px;
    text-align: left;
    background-color: black;
    color: white;   
}

.aTH {
    height: 50px;
}

Now I am almost certain a lot of my code is not "perfect" or following "proper procedures" and if you see any of this feel free to point it out and correct me as ive said im not that good at websites and could definetly learn a thing or two. I will be removing the
tags later when i can get the CSS to properly apply, until then they will stay as my sketchy fix for now.

Cheers for all the help, here is an image to show the effect of my attempts. if you need any more info/pics/other stuff feel free to ask and ill try to get as much as possible up. the footer.php does contain an if thats any consolation so the document does have an end!

Upvotes: 0

Views: 129

Answers (1)

John C.
John C.

Reputation: 45

On my code view the styles are not applying

Have you verified that all cache's have been cleared? I had this issue and I was struggling for quite awhile before I realized that my host cached the files automatically, as well as cloudflare cached it, AND Chrome cached it.

Upvotes: 1

Related Questions