html - ID not applying styles to table -


i trying apply css styles tables using section tag styles not being applied.

here code below.

<!doctype html> <html>     <head>         <link rel="stylesheet" type="text/css" href="stylesheet.css">         <link href="https://fonts.googleapis.com/css?family=open+sans|oswald" rel="stylesheet">      </head>     <body>         <div id="nav">             <a href="assignment1.html">home</a>             <a href="table.html">table</a>             <a href="http://rrc.ca">red river</a>             <a href="http://google.ca">google</a>         </div         <section id="table1">         <table>                 <thead>                     <tr>                         <th>syntax</th>                         <th>description</th>                         <th>example</th>                     </tr>                 </thead>                 <tbody>                     <tr>                         <td> p tag</td>                         <td> p tag stuff</td>                         <td>&lt;p&gt;this paragraph.&lt;/p&gt;</td>                     </tr>                     <tr>                         <td>h1 tag</td>                         <td>allows add header webpage</td>                         <td>&lt;h1&gt;this header&lt;/h1&gt;</td>                     </tr>                     <tr>                         <td>img tag</td>                         <td>allows add image webpage.</td>                         <td>&lt;img src="images/dogpicture.jpg alt="picture of dog"&gt;</td>                     </tr>                     <tr>                         <td>a tag</td>                         <td>allows add links onto webpage.</td>                         <td>&lt;a href="http://youtube.com"&gt;youtube.com&lt;/a&gt;</td>                     </tr>                     <tr>                         <td>div tag</td>                         <td>defines section in html code.</td>                         <td>&lt;div&gt;this text inside div&lt;/div&gt;</td>                     </tr>                     <tr>                         <td>!doctype</td>                         <td>sets type of document.</td>                         <td>&lt;!doctype html&gt;</td>                     </tr>                 </tbody>             </table>         </section>          <ul>             <li>milk</li>             <li>eggs</li>             <li>sugar</li>         </ul>         <ol>             <li>milk</li>             <li>eggs</li>             <li>sugar</li>         </ol>     </body> </html> 

and here css

#nav {     background-color: black;     overflow: hidden; } #nav {     float: left;     display: block;     color: white;     text-align: center;     padding: 18px 20px;     text-decoration: none;     font-size: 22px; } #nav a:hover {     background-color: white;     color: black; }    #nav a:visited{     color:green ; } img{     float:left;     margin:0px auto;     overflow: none; }  #table1 table{     border: 2px dotted black; } #table1 table thead tr{     background-color: green;     padding: 9px 24px;     text-align: center; } #table1 table tbody tr{     background-color: skyblue;     text-align: center; } #table1 table tbody tr:nth-child(even){     background-color: darkgreen; } #table1 table tbody tr:hover {     background-color: red; }  body  {      margin:0px auto;      padding:0px;      background:#e6e6e6;      float: center;      width: 800px;      border: 2px solid black;     } h1{     text-align: left;     float:left;     text-shadow: 10px red;     font-family: oswald; } #textshadow{     text-shadow: 2px 2px #ff0000; } p{     font-family: open sans;     background-color: white; } 

i sure there missing new html , have not been able find. if helps had styles working before added id , section.

you didn't close nav div properly. closing tag missing.

it should be:

<div id="nav">     <a href="assignment1.html">home</a>     <a href="table.html">table</a>     <a href="http://rrc.ca">red river</a>     <a href="http://google.ca">google</a> </div>    <!-- add closing bracket -->  

here fixed version:

#nav {      background-color: black;      overflow: hidden;  }  #nav {      float: left;      display: block;      color: white;      text-align: center;      padding: 18px 20px;      text-decoration: none;      font-size: 22px;  }  #nav a:hover {      background-color: white;      color: black;  }     #nav a:visited{      color:green ;  }  img{      float:left;      margin:0px auto;      overflow: none;  }    #table1 table{      border: 2px dotted black;  }  #table1 table thead tr{      background-color: green;      padding: 9px 24px;      text-align: center;  }  #table1 table tbody tr{      background-color: skyblue;      text-align: center;  }
<!doctype html>  <html>      <head>          <link rel="stylesheet" type="text/css" href="stylesheet.css">          <link href="https://fonts.googleapis.com/css?family=open+sans|oswald" rel="stylesheet">       </head>      <body>          <div id="nav">              <a href="assignment1.html">home</a>              <a href="table.html">table</a>              <a href="http://rrc.ca">red river</a>              <a href="http://google.ca">google</a>          </div>          <section id="table1">          <table>                  <thead>                      <tr>                          <th>syntax</th>                          <th>description</th>                          <th>example</th>                      </tr>                  </thead>                  <tbody>                      <tr>                          <td> p tag</td>                          <td> p tag stuff</td>                          <td>&lt;p&gt;this paragraph.&lt;/p&gt;</td>                      </tr>                      <tr>                          <td>h1 tag</td>                          <td>allows add header webpage</td>                          <td>&lt;h1&gt;this header&lt;/h1&gt;</td>                      </tr>                      <tr>                          <td>img tag</td>                          <td>allows add image webpage.</td>                          <td>&lt;img src="images/dogpicture.jpg alt="picture of dog"&gt;</td>                      </tr>                      <tr>                          <td>a tag</td>                          <td>allows add links onto webpage.</td>                          <td>&lt;a href="http://youtube.com"&gt;youtube.com&lt;/a&gt;</td>                      </tr>                      <tr>                          <td>div tag</td>                          <td>defines section in html code.</td>                          <td>&lt;div&gt;this text inside div&lt;/div&gt;</td>                      </tr>                      <tr>                          <td>!doctype</td>                          <td>sets type of document.</td>                          <td>&lt;!doctype html&gt;</td>                      </tr>                  </tbody>              </table>          </section>            <ul>              <li>milk</li>              <li>eggs</li>              <li>sugar</li>          </ul>          <ol>              <li>milk</li>              <li>eggs</li>              <li>sugar</li>          </ol>      </body>  </html>


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -