Welcome Guest! To access all forums & features, please register an account or sign-in. → Why register?



Why won't my CSS work?


12 replies to this topic - - - - -

#1 Nashy

    Neowinian DOMINATING

  • 7,758 posts
  • Joined: 05-September 04
  • Location: Brisbane, Australia
  • OS: Windows 7 Ultimate x64
  • Phone: Lumia 920 Red

Posted 02 February 2013 - 23:15

Hi all. I'm having a bit of trouble with some CSS not working, and I'm unable to see why. I'm not a CSS guru by any means, so no doubt it's something really simple that I've missed.

Also, before anyone vomits at the use of tables, they're only used because this particular page is not going to be used by many people, and I'm not the greatest with DIVs so I didn't really have the time. (I'm still learning how to use DIVs correctly).

Anyway, it's a bit of a mess given I have been trying different thigns, so I'd relaly appreciate anyone who could take a look and guide me in the right direction.

Note: I've included all the PHP that I've had made for me, just in case it is something to do with that.


<head>
<link href="css.css" rel="stylesheet" type="text/css" />
</head>
<!--Bismillahir Rahmanir Rahim-->
<?PHP

include('library/database.php');
$db = new database();
/****
  * If no match is defined to be showed
  * Chooses the first match from the list
  *
  */

function randomMatch()
{
  $match=-1;
  $q = "SELECT * FROM game WHERE active = '1'";
  $r = mysql_query($q) or die("Error in selecting first match: ".mysql_error());
  if(mysql_num_rows($r)==0){
   echo "NO MATCH IS CURRENTLY ACTIVE!";
   exit;
  }

  while($row = mysql_fetch_array($r)){
   $match = $row['id'];
   break;
  }
  return $match;
}

/**
  *
  *
  *
  */

function thisMatch(){
   return $_REQUEST['match'];
}

/**
  *
  * Returns Id of the current match.
  * if an id is specified then thisMatch();
  * else randomMatch is called
  *
  */

function getId(){
  $id=-1;
  if(!isset($_REQUEST['match'])){   //GET parameter null
   $id = randomMatch();
  }
  else $id = thisMatch();

  if($id==-1){
   reportExit();
   return -1;
  }
  return $id;
}

/**
  *
  * Data variable keeps the data of the row with fixed id
  *
  */

function fetchData(){
  $id = getId();

  if($id==-1)return -1;
  $q1 = "SELECT * FROM game WHERE id = '$id'";
  $r1 = mysql_query($q1) or die("Error in fetching first active match, Level: 1:: ".mysql_error());
  $data = mysql_fetch_assoc($r1) or die("Error in fetching first active match, Level: 2:: ".mysql_error());;
  return $data;
}

/**
  *
  * If No match is currently active, do exit
  *
  */

function reportExit(){
   echo "No match is currently active!";
   exit;
}
/**
  *
  * Returns first team's name
  */

function getTeamA($data){
  return $data['team1'];
}

/**
  *
  * Returns second team's name
  */

function getTeamB($data){
  return $data['team2'];
}

function getScoreA($data){
  return $data['score1'];
}

function getScoreB($data){
  return $data['score2'];
}

function getLogo($team){
  $team=strtolower($team);
  return "images/$team.png";
}

function printPlayers($data,$id){
   $var = 'player'.$id;
   $str = $data[$var];
   $ar  = explode(',',$str);
   foreach($ar as $ars){
    $ars = ltrim($ars);
    echo "&nbsp;&nbsp;&nbsp;".$ars."<BR>";
   }
}

function printActiveGames($data){
  $links = $data['link'];
  $links = explode(',',$links);
  echo "<BR>";

  foreach($links as $link){
   echo "<a href=$link>".$link."</a><BR>";
  }
  echo "<BR>Currently Active Games:<BR>";
  $q = "SELECT * FROM game WHERE active = '1'";
  $r = mysql_query($q) or die("Error in selecting active games on line: 152".mysql_error());
  while($row=mysql_fetch_array($r)){
   echo "<a href='index.php?match=".$row['id']."'>".$row['team1']." VS ".$row['team2']."</a><BR>";
  }
}

function printNote($id){
  $q = "SELECT * FROM notes WHERE gameid='$id' ORDER BY id ASC";
  $r = mysql_query($q) or die("Error in PrintNote:: ".mysql_error());
  while($row=mysql_fetch_array($r)){
  $time = $row['time'];
  $note = $row['body'];
  echo '<tr><td id="notetime">'; 
  $fDigit = $time{0};
  if($fDigit>='0'&&$fDigit<='9'){
   if($time%10==1&&$time!=11)echo $time."st Minute";
   else if($time%10==2&&$time!=12)echo $time."nd Minute";
   else echo $time."th Minute";
  }
  else echo $time;

  echo "</TD><TD id='note'>$note</td></tr>";
  echo "<tr style='border:0'><td style='border:0' colspan='2' width='100%'>&nbsp;</td></tr>";
  }
}

$data=fetchData();

$location = $data['location'];
$time	 = $data['time'];
$str	  = $data['link'];
$links    = explode(',',$str);

$teamA = getTeamA($data);
$teamB = getTeamB($data);

$scoreA = getScoreA($data);
$scoreB = getScoreB($data);
$logoA  = getLogo($teamA);
$logoB  = getLogo($teamB);
?>
<html>
<body>
<table align='center' border='0' width='600'>
<tr>
<td id="hometeam"><img src='<?PHP echo $logoA?>'></td>
<td align='center' width='30'>Vs</td>
    <td id="awayteam"><img src='<?PHP echo $logoB?>' ></td></tr>
<tr>
<td class="teamtext"><?PHP echo $teamA?></td>
    <td align='center' width='30'></td>
    <td class="teamtext"><?PHP echo $teamB?></td>
</tr>

<tr class="teamtext">
<td class="score"><?PHP echo $scoreA?></td>
    <td>&nbsp;</td>
    <td><?PHP echo $scoreB?></td>
</tr>
<tr class="players">
<td><?PHP printPlayers($data,1);?></td>
    <td><?PHP echo $location."<br>".$time;printActiveGames($data)?></td>
    <td><?PHP printPlayers($data,1)?></td>
</tr>
<tr>
<td height="113" colspan="3"><div><table border='0' width='100%'>
<tr>
  <td id="notetime2">&nbsp;</td>
  <td id="note2">&nbsp;</td>
</tr>
<?PHP printNote($data['id'])?></table></div></td></tr>
</table>
</body>
</html>

@charset "utf-8";
/* CSS Document */
/* User Side Below */
#overall_container {
width: 600px;
vertical-align:top;
margin: auto;
z-index:2;
border:#000;
font-family: Calibri, Verdana, Geneva, sans-serif;
font-size: 12px;
}
#hometeam {
width: 250px;
vertical-align:middle;
margin:auto;
background-color:#EEEEEE;
text-align:center;
float:left;
border:none;
}
#awayteam {
width: 250px;
vertical-align:middle;
margin:auto;
background-color:#EEEEEE;
text-align:center;
float:left;
border:none;
}
#vsbox {
width: 100px;
vertical-align:middle;
margin:auto;
background-color:#EEEEEE;
text-align:center;
float:left;
border:none;
  font-family: Calibri, Verdana, Geneva, sans-serif;
font-size: 12px;
}
#location {
width: 400px;
vertical-align:middle;
background-color:#EEEEEE;
text-align:center;
margin-left: Auto;
margin-right: Auto;
border:none;

}
#notetime {
width: 30%;
font-family: Calibri, Verdana, Geneva, sans-serif;
font-size: 11px;
font-style:italic;
background-color:#C9FCCD;
border:none;
padding:0px;
}
#note {
width: 100%;
font-family: Calibri, Verdana, Geneva, sans-serif;
font-size: 12px;
background-color:#C4FA8D;
padding:0px;
}
/* Admin Panel Below */
#overall_pass {
width: 60%;
}
#login_title {
font-family: Calibri, Verdana, Geneva, sans-serif;
font-size: 14px;
font-weight: bolder;
background-color: #036;
color: #CCC;
text-align: center;
.team {
font-family: Verdana, Geneva, sans-serif;
}
/* Fonts */
.teamtext {
font-family: Calibri, Verdana, Geneva, sans-serif;
font-size: 16px;
font-weight: Bolder;
text-align:center;
}
#teamtext {
font-family: Calibri, Verdana, Geneva, sans-serif;
font-size: 16px;
font-weight: Bolder;
text-align:center;
}
.regulartext {
font-family: Calibri, Verdana, Geneva, sans-serif;
font-size: 14px;
text-align:center;
}
.players {
font-family: Calibri, Verdana, Geneva, sans-serif;
font-size: 12px;
text-align:left;
}
.score {
font-family: Calibri, Verdana, Geneva, sans-serif;
font-size: 22px;
text-align:centre;
}



#2 primexx

    Neowinian ULTRAKILL

  • 12,023 posts
  • Joined: 24-April 05

Posted 03 February 2013 - 01:13

what are you trying to do and which part isn't working?

#3 saturnslullaby

    Neowinian²

  • 118 posts
  • Joined: 28-April 05

Posted 03 February 2013 - 01:31

well your css file looks fine. just make sure it is named "css.css" and is located in the root of your web dir.

#4 OP Nashy

    Neowinian DOMINATING

  • 7,758 posts
  • Joined: 05-September 04
  • Location: Brisbane, Australia
  • OS: Windows 7 Ultimate x64
  • Phone: Lumia 920 Red

Posted 03 February 2013 - 02:53

View Postprimexx, on 03 February 2013 - 01:13, said:

what are you trying to do and which part isn't working?

I want to change the font in each table row.

View Postsaturnslullaby, on 03 February 2013 - 01:31, said:

well your css file looks fine. just make sure it is named "css.css" and is located in the root of your web dir.

It is. The notes section towards the bottom works, but nothing else.

#5 threetonesun

    Neowinian ULTRAKILL

  • 11,301 posts
  • Joined: 26-February 02

Posted 03 February 2013 - 03:11

Use Firefox or Chrome and inspect / debug the page. It will show you which styles are being load and/or overriden to help you track down the issue.

#6 Sartoris

    Resident Fanatic

  • 703 posts
  • Joined: 21-August 04
  • Location: Normal, IL USA

Posted 03 February 2013 - 03:15

You are missing a closing bracket for #login_title.

#7 Jose_49

    Neowinian Wise One

  • 3,016 posts
  • Joined: 30-July 09

Posted 03 February 2013 - 03:16

Also, note that at the last code, it says centre and not center with ER at the end.
There are many similar properties. You can group them together with a comma.

#8 The_Decryptor

    THE ALPHA CEPH!

  • 18,355 posts
  • Joined: 28-September 02
  • Location: Sol System
  • OS: WinLin X 10.9 Ill-tempered Badger

Posted 03 February 2013 - 03:48

This isn't related to your CSS, but your code has an SQL injection vulnerability (You're directly including part of the query string into an SQL query with no validation), use PDO+prepared statements instead of the mysql_* APIs and you won't have that issue (It'll be faster too)

#9 OP Nashy

    Neowinian DOMINATING

  • 7,758 posts
  • Joined: 05-September 04
  • Location: Brisbane, Australia
  • OS: Windows 7 Ultimate x64
  • Phone: Lumia 920 Red

Posted 03 February 2013 - 05:31

View PostSartoris, on 03 February 2013 - 03:15, said:

You are missing a closing bracket for #login_title.

Thanks so much. You have no idea how much I have stared at this CSS for.

View PostJose_49, on 03 February 2013 - 03:16, said:

Also, note that at the last code, it says centre and not center with ER at the end.
There are many similar properties. You can group them together with a comma.

I didn't realise that could be done, I appreciate it.

View PostThe_Decryptor, on 03 February 2013 - 03:48, said:

This isn't related to your CSS, but your code has an SQL injection vulnerability (You're directly including part of the query string into an SQL query with no validation), use PDO+prepared statements instead of the mysql_* APIs and you won't have that issue (It'll be faster too)

Thanks a lot, I have no idea what PDO and prepared statements is, but I will pass it on to the person who made it for me. Thanks for pointing it out.

#10 OP Nashy

    Neowinian DOMINATING

  • 7,758 posts
  • Joined: 05-September 04
  • Location: Brisbane, Australia
  • OS: Windows 7 Ultimate x64
  • Phone: Lumia 920 Red

Posted 03 February 2013 - 06:16

Now it won't pay attention to my fonts.

#11 ACTIONpack

    Graphic Designer

  • 1,666 posts
  • Joined: 10-August 03
  • Location: Lawrenceville, GA
  • OS: Windows 8 Pro
  • Phone: HTC Windows 8X

Posted 04 February 2013 - 17:29

Change CSS.css to style.css. Make it less confusing.

#12 nyolc8

    Resident Fanatic

  • 595 posts
  • Joined: 25-May 07
  • Location: Budapest, Hungary
  • OS: OSX Mountain Lion 10.8.2, Windows 8 Pro WMC

Posted 04 February 2013 - 17:47

View PostNashy, on 03 February 2013 - 06:16, said:

Now it won't pay attention to my fonts.
Try to put them into quote marks, so instead of Calibri, write "Calibri" and etc.

#13 threetonesun

    Neowinian ULTRAKILL

  • 11,301 posts
  • Joined: 26-February 02

Posted 04 February 2013 - 17:59

View Postnyolc8, on 04 February 2013 - 17:47, said:

Try to put them into quote marks, so instead of Calibri, write "Calibri" and etc.

No need. This:

font-family: Calibri, Candara, Segoe, "Segoe UI", Optima, Arial, sans-serif;

Will work perfectly fine. Quotes are only needed for white space or hypens, or if you were trying to use a font called "sans-serif" instead of the generic sans-serif.

OP, are you sure it's not paying attention to any fonts? Based on the original code, you've declared them all about a dozen times.