6 Replies - 513 Views - Last Post: 19 February 2014 - 02:08 PM

#1 jphoc13  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 166
  • Joined: 08-July 13

Why does my table have a strange layout?

Posted 19 February 2014 - 01:50 PM

Just started on HTML about a week ago and my first assignment is to create a table on a web site.

Here is my code:

<html>
    <head>
        <title>Index</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width">
    </head>
    <body>
         <h1>List of Employees</h1>
        <table cellpadding="20">
            <tr>
            <td><b>Name</b></td>
            <td><b>EmployeeID</b></td>
            <td><b>Position</b></td
            <td><b>Weekly Pay</b></td>
            </tr>
            <tr class="two"><td>Patricia Hochbaum</td><td>64949</td><td>Chef</td><td>196.0</td></tr>
<tr class="one"><td>Jackie Edwards</td><td>78346</td><td>Busser</td><td>324.0</td></tr>
<tr class="two"><td>Patricia Hochbaum</td><td>68369</td><td>Server</td><td>576.0</td></tr>
<tr class="one"><td>Jackie Edwards</td><td>92620</td><td>Host</td><td>900.0</td></tr>
<tr class="two"><td>Jase Stokes</td><td>51054</td><td>Host</td><td>1089.0</td></tr>
        </table>


    </body>
</html>


Here is how it turns out, why is my bolded Weekly Pay not above the weekly pay part. Excuse the bad copy and paste format below that:

List of Employees

Weekly Pay
Name EmployeeID Position
Patricia Hochbaum 64949 Chef 196.0
Jackie Edwards 78346 Busser 324.0
Patricia Hochbaum 68369 Server 576.0
Jackie Edwards 92620 Host 900.0
Jase Stokes 51054 Host 1089.0

Is This A Good Question/Topic? 0
  • +

Replies To: Why does my table have a strange layout?

#2 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3181
  • View blog
  • Posts: 10,659
  • Joined: 12-December 12

Re: Why does my table have a strange layout?

Posted 19 February 2014 - 01:57 PM

You are missing the closing angle at the end of this line:
<td><b>Position</b></td   <<< here

You are also missing a DOCTYPE declaration.

You should also use th-tags for a header row.

If you use th-tags then you can make them all bold using css.

The cellpadding table-attribute is not supported in HTML5, use css.
Was This Post Helpful? 1
  • +
  • -

#3 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3479
  • View blog
  • Posts: 10,025
  • Joined: 08-June 10

Re: Why does my table have a strange layout?

Posted 19 February 2014 - 01:59 PM

regarding the one & two classes, if you’re using a decently modern browser, you could achieve the same using CSS’s :nth-child(odd) or :nth-child(even) pseudo-classes.
Was This Post Helpful? 0
  • +
  • -

#4 jphoc13  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 166
  • Joined: 08-July 13

Re: Why does my table have a strange layout?

Posted 19 February 2014 - 02:00 PM

View Postandrewsw, on 19 February 2014 - 01:57 PM, said:

You are missing the closing angle at the end of this line:
<td><b>Position</b></td   <<< here

You are also missing a DOCTYPE declaration.

You should also use th-tags for a header row.

If you use th-tags then you can make them all bold using css.

The cellpadding table-attribute is not supported in HTML5, use css.

So far we just learned how to make a table. We are focusing on Java and just doing a few weeks of HTML to give us a basis of it.

So I have no idea what you mean by doc type declaration or the th-tags. I will probably have to teach myself that since the teacher wants us to self teach pretty much everything.
Was This Post Helpful? 0
  • +
  • -

#5 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3181
  • View blog
  • Posts: 10,659
  • Joined: 12-December 12

Re: Why does my table have a strange layout?

Posted 19 February 2014 - 02:04 PM

Quote

We are focusing on Java Javascript

FTFY Java and Javascript are two completely different languages.
Was This Post Helpful? 0
  • +
  • -

#6 jphoc13  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 166
  • Joined: 08-July 13

Re: Why does my table have a strange layout?

Posted 19 February 2014 - 02:06 PM

I am also still getting the display wrong so closing the tag was needed but it didn't seem to fix that issue.
Was This Post Helpful? 0
  • +
  • -

#7 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3181
  • View blog
  • Posts: 10,659
  • Joined: 12-December 12

Re: Why does my table have a strange layout?

Posted 19 February 2014 - 02:08 PM

It worked for me, all it requires is adding > to td at the end of that line.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1