Jump to content


Photo

Css not loading despite linking to it correctly


Best Answer requinix, 03 October 2017 - 08:49 AM

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? Go to the full post


  • Please log in to reply
3 replies to this topic

#1 natturefrk

natturefrk
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 03 October 2017 - 08:34 AM

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.skillersr...sn=CrypticKaxar

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

 

css file:
http://skillersrealm...es/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, 03 October 2017 - 08:35 AM.


#2 requinix

requinix
  • Administrators
  • Lazy Administrator
  • 9,240 posts
  • LocationWA

Posted 03 October 2017 - 08:49 AM   Best Answer

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?
The Reimann Zeta Function Trolley Problem | "Summer is when I, the great ice fairy, can show my true power!"

#3 natturefrk

natturefrk
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 04 October 2017 - 03:23 AM

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



#4 natturefrk

natturefrk
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 04 October 2017 - 03:40 AM

I am thinking it was the hack I was using to stop caching, because originally I was having issues with caching and css not updating. I am not having the issues, fingers crossed, now


Edited by natturefrk, 04 October 2017 - 03:40 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users