Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Jun 2009
    Location
    Newcastle Upon Tyne, UK
    Posts
    2,652
    Tokens
    1,389
    Habbo
    lRhyss

    Latest Awards:

    Default XHTML 1.0 Strict Table Width Help

    Okay so I've never worked with tables in xhtml 1.0 strict, so I have a question.

    When I validate my code it says:

    "there is no attribute "width" <th width="21%" scope="col">Name of Artist</th>"

    I need the width as %'s for a fluid layout, the answer is probably simple and I probably look stupid but when I google it everyones like "use jquery" and I"m like no, I want it pure html & css.

    Any help is appreciated, thanks xo

  2. #2
    Join Date
    Jul 2004
    Location
    Scotland
    Posts
    17,702
    Tokens
    61,184
    Habbo
    Habbic

    Latest Awards:

    Default

    CSS

    <th style="width:20%;">

  3. #3
    Join Date
    Jun 2009
    Location
    Newcastle Upon Tyne, UK
    Posts
    2,652
    Tokens
    1,389
    Habbo
    lRhyss

    Latest Awards:

    Default

    Quote Originally Posted by scottish View Post
    CSS

    <th style="width:20%;">

    Thanks, but, I have different width for each column (sorry, should have mentioned earlier):

    Code:
    <table width="80%" border="1">    <tr>
          <th width="21%" scope="col">Name of Artist</th>
          <th width="25%" scope="col">Location</th>
          <th width="21%" scope="col">Date</th>
          <th width="15%" scope="col">Start Time</th>
          <th width="18%" scope="col">End Time</th>
        </tr>
        <tr>
          <td>Billie-Jean Heslop</td>
          <td>Victoria and Albert</td>
          <td><div align="center">11th November 2014</div></td>
          <td><div align="center">10:00 AM</div></td>
          <td><div align="center">5:00 PM</div></td>
        </tr>
        <tr>
          <td>Billie-Jean Heslop</td>
          <td>British Museum</td>
          <td><div align="center">15th November 2014</div></td>
          <td><div align="center">1:00 PM</div></td>
          <td><div align="center">6:00 PM</div></td>
        </tr>
        <tr>
          <td>Billie-Jean Heslop</td>
          <td>National Gallery</td>
          <td><div align="center">20th November 2014</div></td>
          <td><div align="center">10:00 AM</div></td>
          <td><div align="center">4:00 PM</div></td>
        </tr>
        <tr>
          <td>Robert MacPherson</td>
          <td>National Gallery</td>
          <td><div align="center">29th November 2014</div></td>
          <td><div align="center">1:00 PM</div></td>
          <td><div align="center">4:00PM</div></td>
        </tr>
        <tr>
          <td>Charlie Parvin</td>
          <td>Brtish Museum</td>
          <td><div align="center">20th January 2015</div></td>
          <td><div align="center">9:00 AM</div></td>
          <td><div align="center">12:00 PM</div></td>
        </tr>
        <tr>
          <td>Charlie Parvin</td>
          <td>British Museum</td>
          <td><div align="center">21st January 2015</div></td>
          <td><div align="center">9:00 AM</div></td>
          <td><div align="center">12:00 PM</div></td>
        </tr>
      </table>
    so would it be:

    Code:
    <th width="21%" scope="col">Name of Artist</th>
          <th style = "width:25%" scope="col">Location</th>
          <th style = "width:21%" scope="col">Date</th>
          <th style = "width:15%" scope="col">Start Time</th>
          <th style = "width:18%" scope="col">End Time</th>
    Last edited by lRhyss; 23-04-2014 at 05:21 PM.

  4. #4
    Join Date
    Jul 2004
    Location
    Scotland
    Posts
    17,702
    Tokens
    61,184
    Habbo
    Habbic

    Latest Awards:

    Default

    Then use the style attribute in each instead of the width?

    so;

    <th style="width:21%;">...</th><th style="width:25%;">...</th> etc

  5. #5
    Join Date
    Jun 2009
    Location
    Newcastle Upon Tyne, UK
    Posts
    2,652
    Tokens
    1,389
    Habbo
    lRhyss

    Latest Awards:

    Default

    Quote Originally Posted by scottish View Post
    Then use the style attribute in each instead of the width?

    so;

    <th style="width:21%;">...</th><th style="width:25%;">...</th> etc
    Sorry yeah I realised then edited my last post after you replied haha, thanks man!

    + rep

    Edit:

    @scottish, also:

    "there is no attribute "align" <td><div align="center">11th November 2014</div></td>"

    would it be style = "width:20%, align="center" ?
    Last edited by lRhyss; 23-04-2014 at 05:30 PM.

  6. #6
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    Stop using XHTML standards and stop caring about being standards compliant.
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  7. #7
    Join Date
    Jul 2004
    Location
    Scotland
    Posts
    17,702
    Tokens
    61,184
    Habbo
    Habbic

    Latest Awards:

    Default

    Didn't see edit

    text-align:center;

    would be the CSS for it, so <div style="text-align:center;">

  8. #8
    Join Date
    Jun 2009
    Location
    Newcastle Upon Tyne, UK
    Posts
    2,652
    Tokens
    1,389
    Habbo
    lRhyss

    Latest Awards:

    Default

    Quote Originally Posted by Recursion View Post
    Stop using XHTML standards and stop caring about being standards compliant.
    It's an assignment, I need to use xhtml, or I wouldn't be using the ****.

    Quote Originally Posted by scottish View Post
    Didn't see edit

    text-align:center;

    would be the CSS for it, so <div style="text-align:center;">
    ahh okay, thanks man!

  9. #9
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default

    Quote Originally Posted by lRhyss View Post
    It's an assignment, I need to use xhtml, or I wouldn't be using the ****.
    Tell whoever set the assignment that XHTML is a pointless standard because it's only useful if everyone were using it everywhere.
    Chippiewill.


  10. #10
    Join Date
    Jun 2009
    Location
    Newcastle Upon Tyne, UK
    Posts
    2,652
    Tokens
    1,389
    Habbo
    lRhyss

    Latest Awards:

    Default

    Quote Originally Posted by Chippiewill View Post
    Tell whoever set the assignment that XHTML is a pointless standard because it's only useful if everyone were using it everywhere.
    I expressed my views about it to him already, so have half of my seminar group :/

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •