0
votes

Ive been trying to increase the font size for the TH tag via the css style sheet:

th {
    color:#D5DDE5;
    background:#1b1e24;
    border-bottom:4px solid #9ea7af;
    border-right: 1px solid #343a45;
    font-size:23px;
    font-weight: 100;
    padding:24px;
    text-align:left;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    vertical-align:middle;
  }

for the following code:

<?php
include ('connect-mysql.php');

$sqlget="SELECT * FROM data ORDER BY score desc LIMIT 10";
$sqldata= mysqli_query($conn, $sqlget);

echo "<table width='1500'>";
echo "<tr>";
echo "<th>Position</th>";
echo "<th>First Name</th>";
echo "<th>Last Name</th>";
echo "<th>Score</th>";
echo "</tr>";
$counter = 1;
while($row = mysqli_fetch_array($sqldata, MYSQLI_ASSOC)) {
    echo "<tr><td width='5%'>";
    echo "<b>".$counter."</b>";
    echo "</td><td>";
    echo "<div style='font-size:40px'>";
    echo "<b>".$row['firstName']."</b>";
    echo "</div>";
    echo "</td><td>";
    echo "<div style='font-size:40px'>";
    echo "<b>".$row['lastName']."</b>";
    echo "</div>";
    echo "</td><td width='20%'>";
    echo "<b>".$row['score']."</b>";
    echo "</td></tr>";
    $counter++;
    }
echo "</table>";
?>

As you can see i have been using inline css styles as the external style sheet seems to have jammed, i would like to increase the font size of the TH tags but there is no response when changing 'font-size:23px'

What am i doing wrong ?

3
did you clear cache? - treyBake
Inspect the element in Chrome and click on the 'computed' tab to see which property is responsible for setting the font-size on that element. - Royal Wares
don't use !important unless it's the only way to do it, which is probably not the case here. The future you will be thankful. Actually it might be another !important tag messing with this here. - CoderPi
Trying adding an ID or class to the tag to increase CSS specificity w3schools.com/css/css_specificity.asp - Nathan Patnam

3 Answers

0
votes

Try to change font-size in the browser development panel.

It will show you if there are some other css instructions that overwrites yours (or any other reason).

0
votes

Thanks for this I managed to get it to work using kunals help.

echo "<th style='font-size:2.0em'>Position</th>";

using "" instead of ''inside the th tag causes php errors for me. using px caused formatting issues so i used em

I am still wondering why my CSS style sheet isnt working :/

-2
votes

Make it like this, and you're done...

echo "<table width='1500'>";
echo "<tr>";
echo "<th style="font-size:23px;">Position</th>";
echo "<th style="font-size:23px;">First Name</th>";
echo "<th style="font-size:23px;">Last Name</th>";
echo "<th style="font-size:23px;">Score</th>";
echo "</tr>";

add inline css to th tags...