'CSS not working on table
The style settings i'm making for my table in my CSS file do not work in the html that i made
CSS:
body {
background-color: #ccffff;
}
h1 {
font-family: verdana;
}
h2 {
font-family: verdana;
}
h3 {
font-family: verdana;
}
h4 {
color: red;
font-family: verdana;
border: 3px solid black;
padding: 15px;
margin: 10px;
}
table {
width: 100%;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
p {
font-family: verdana
}
#p01 {
color: blue;
font-size: 200%;
}
p.error {
color: red;
}
HTML:
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>My second HTML</title>
<link rel="stylesheet" href="css/mijn_eerste_css.css">
</head>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jan</td>
<td>Jansens</td>
<td>20</td>
</tr>
<tr>
<td>Kees</td>
<td>Pieters</td>
<td>21</td>
</tr>
</table>
When I put the exact same style settings in the HTML file like so:
<style>
table {
width: 100%;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
</style>
It works just fine. Why doesn't this work when it's in the CSS and what do I have to do to fix it? (The CSS is linked properly, all the other style settings work just fine.)
Solution 1:[1]
I tried and it works just fine for me. it shows border also correctly.
<link rel="stylesheet" href="css/mijn_eerste_css.css">.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Satya Dev Addepally |