Jump to content

Css not loading despite linking to it correctly


Go to solution Solved by requinix,

Recommended Posts

Okay I have been at this for two days now trying to figure out the source of the problem. When I use firebug to inspect the elements there is no css being applied, even though the link to external stylesheet is correct. When I use chrome developer to inspect the elements it seems default styles are being applied but not the styles I set. I checked the network portion of firebug and chrome developer and the css file in question is no where to be found. So this leads me to believe that the css file is not being loaded. I don't know if this matters but the table info on this page is being dynamically generated by php. The only way that I can get the styles to apply is if I put all the css in external stylesheet internally into stats.php. Another thing I have noticed is that I cannot use classes on any of the dynamically created content and I had to use a mix between tag selectors and inline styling. The page in question is: http://www.skillersrealm.com/includes/scripts/stats.php?rsn=CrypticKaxar

This is what the page is suppose to look like:
https://imgur.com/a/kexYV

 

css file:
http://skillersrealm.com/includes/css/stat.css

<?php

$dir_sep = DIRECTORY_SEPARATOR;

$back_one = '..' . $dir_sep;

$back_two = '..' . $dir_sep . '..' . $dir_sep;

require_once __DIR__ . $dir_sep . $back_one . 'init.php';

if(isset($_GET['rsn']) === TRUE){

	$rsn = $_GET['rsn'];

	$query = $conn->prepare("SELECT points, xp, part_total, conduct_total, conduct_pts, help_pts, cit_pts, event_pts, talk_pts FROM users WHERE rsn = :rsn");

	$query->execute(array(":rsn" => $rsn));

?>

<!-- END PHP -->

<style type="text/css" media="screen">


</style>

<!DOCTYPE html>

<html>

<head>

	<!-- INCLUDE GOOGLE FONT -->
	<link href="https://fonts.googleapis.com/css?family=Handlee" rel="stylesheet">

	<link rel="stylesheet" src="../css/stat.css" type="text/css" media="screen" />

</head>

<body>

<div class="mask">

	<div class="content">

	<div class="stats_container">

		<div style="float: left; padding-left: 1%;"><img src="../images/staff.png" alt="" height="750" width="200" style="float: left;" /></div>

		<div style="float: right; padding-right: 1%;"><img src="../images/staff2.png" alt="" height="750" width="200" /></div>

		<h3 style="color: rgba(50, 205, 50, 1.0);"><?php echo $rsn; ?>'s Stat Page</h3>

		<table class="stats" border="1">

<!-- START PHP -->

			<?php

				while($row = $query->fetch(PDO::FETCH_ASSOC)){

					$grand_total = $row['points'];

						$xp = $row['xp'];

						$cit_pts = $row['cit_pts'];

						$event_pts = $row['event_pts'];

						$talk_pts = $row['talk_pts'];

						$conduct_pts = $row['conduct_pts'];

						$help_pts = $row['help_pts'];

						$conduct_total = $row['conduct_total'];

						$part_total = $row['part_total'];

					}

					//BRINGS IN THE POINTS TABLES
					require_once __DIR__ . $dir_sep .$back_two . 'templates' . $dir_sep . "stats_tables.php";

				}

			?>

			<!-- END PHP -->

		</table><br /><br />

			<?php

				//if(logged_in() === TRUE && $admin_id ="1" || $admin_id = "2"){

					//BRINGS IN THE POINT BUTTONS
					require_once __DIR__ . $dir_sep .$back_two . 'templates' . $dir_sep . "pts_btns.php";

				//}

			?>

		</div><!-- END OF .STATS_CONTAINER DIV -->

	</div><!-- END OF .CONTENT DIV -->

</div><!-- END OF .MASK DIV-->

</body>

</html>

Edited by natturefrk
  • Solution

Take a look at these two lines:

<link href="https://fonts.googleapis.com/css?family=Handlee" rel="stylesheet">
<link rel="stylesheet" src="../css/stat.css" type="text/css" media="screen" />
The first one works and the second one doesn't. There are three differences between them and one of them is the source of the problem. Can you find it?
  • Like 2

Wow I just feel stupid. I have been dealing with these problems with my css acting weirdly that I didn't even notice that I made that mistake. Here is the weirder part is that before internally I couldn't assign classes to the dynamic content now it is letting me do it

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.