Forum Table tag

Discussion in 'Announcements' started by Chokladkakan, Oct 11, 2014.

Thread Status:
Not open for further replies.
  1. Chokladkakan
    Offline

    Chokladkakan Web Developer

    Joined:
    Feb 2, 2014
    Messages:
    421
    Likes Received:
    986
    There is now a [table] tag, along with [tr] for table rows, [th] for table headers and [td] for table cells. The way they work is similar to that of ordinary HTML tables:
    • All tables start and end with [table] and [/table] respectively;
    • All table rows start and end with [tr] and [/tr] (tr being table row);
    • Inside table rows there is [th] and [/th] for table headers and [td] and [/td] for table data.
    Below is a simple example table.
    Code:
    [table]
        [tr]
            [th]Number[/th]
            [th]Letter[/th]
        [/tr]
        [tr]
            [td]1[/td]
            [td]a[/td]
        [/tr]
        [tr]
            [td]2[/td]
            [td]b[/td]
        [/tr]
    [/table]
    Number Letter
    1 a
    2 b
    Note that spaces and newlines between the table components are ignored: feel free to use them in order to help yourself organise your table structure.​

    All of these tags support some optional arguments:
    • table:
      • align: one of left, center or right for the table itself, left being default,
      • bgcolor: either a colour name (red, blue, et cetera), a hexadecimal colour value or an rgb(0.1, 0.2, 0.3) type value,
      • width: a percentage between 1% and 100%.
    • tr:
      • align: one of left, center or right; this is overridden by th and td alignments,
      • bgcolor: either a colour name (red, blue, et cetera), a hexadecimal colour value or an rgb(0.1, 0.2, 0.3) type value.
    • th:
      • align: one of left, center or right, center being default,
      • bgcolor: either a colour name (red, blue, et cetera), a hexadecimal colour value or an rgb(0.1, 0.2, 0.3) type value,
      • colspan: one or more digits describing how many columns the table cell should span,
      • rowspan: one or more digits describing how many rows the table cell should span,
      • width: a percentage between 1% and 100%. Works best when used alongside table width.
    • td:
      • align: one of left, center or right, left being default,
      • bgcolor: either a colour name (red, blue, et cetera), a hexadecimal colour value or an rgb(0.1, 0.2, 0.3) type value,
      • colspan: one or more digits describing how many columns the table cell should span,
      • rowspan: one or more digits describing how many rows the table cell should span,
      • width: a percentage between 1% and 100%. Works best when used alongside table width.
    The order of arguments doesn't matter. Multiple arguments should be separated with a space. [table="align=right width=30%"], for example, will cause the table to be aligned to the right of the message and to span thirty per cent of the message's width.

    There is also a [caption] tag for adding a caption above a table, detailing what it contains. Below are two more advanced examples making use of captions and arguments.

    Code:
    [table="align=center width=30%"]
        [caption]A Cayley table of the group ℤ[sub]5[/sub][/caption]
        [tr]
            [th]+[/th]
            [th]0[/th]
            [th]1[/th]
            [th]2[/th]
            [th]3[/th]
            [th]4[/th]
        [/tr]
        [tr="align=center"]
            [th]0[/th]
            [td]0[/td]
            [td]1[/td]
            [td]2[/td]
            [td]3[/td]
            [td]4[/td]
        [/tr]
        [tr="align=center"]
            [th]1[/th]
            [td]1[/td]
            [td]2[/td]
            [td]3[/td]
            [td]4[/td]
            [td]0[/td]
        [/tr]
        [tr="align=center"]
            [th]2[/th]
            [td]2[/td]
            [td]3[/td]
            [td]4[/td]
            [td]0[/td]
            [td]1[/td]
        [/tr]
        [tr="align=center"]
            [th]3[/th]
            [td]3[/td]
            [td]4[/td]
            [td]0[/td]
            [td]1[/td]
            [td]2[/td]
        [/tr]
        [tr="align=center"]
            [th]4[/th]
            [td]4[/td]
            [td]0[/td]
            [td]1[/td]
            [td]2[/td]
            [td]3[/td]
        [/tr]
    [/table]
    A Cayley table of the group ℤ5
    + 0 1 2 3 4
    0 0 1 2 3 4
    1 1 2 3 4 0
    2 2 3 4 0 1
    3 3 4 0 1 2
    4 4 0 1 2 3

    Code:
    [table]
        [tr]
            [th="colspan=2"]Name[/th]
        [/tr]
        [tr]
            [th]Surname[/th]
            [th]First name[/th]
            [th]Age[/th]
        [/tr]
        [tr]
            [td="rowspan=2 bgcolor=lightcoral"]Doe[/td]
            [td]Jane[/td]
            [td]34[/td]
        [/tr]
        [tr]
            [td]John[/td]
            [td]31[/td]
        [/tr]
    [/table]
    Name
    Surname First name Age
    Doe Jane 34
    John 31

    Code:
    [table="width=50%"]
        [tr]
            [th="width=60%"]Monster[/th]
            [th]Level[/th]
            [th]Experience[/th]
        [/tr]
        [tr]
            [td]Snail[/td]
            [td]1[/td]
            [td]12[/td]
        [/tr]
        [tr]
            [td]Blue Snail[/td]
            [td]2[/td]
            [td]16[/td]
        [/tr]
        [tr]
            [td]Red Snail[/td]
            [td]5[/td]
            [td]32[/td]
        [/tr]
    [/table]
    Monster Level Experience
    Snail 1 12
    Blue Snail 2 16
    Red Snail 5 32
     
    Last edited: Oct 16, 2014
  2. Katsuruka
    Offline

    Katsuruka Donator

    Joined:
    May 10, 2013
    Messages:
    10,977
    Likes Received:
    5,320
    Nice work, Chok! This is a very welcome feature! =)
     
  3. DemSheddy
    Offline

    DemSheddy Well-Known Member

    Joined:
    Apr 28, 2014
    Messages:
    149
    Likes Received:
    90
    Gender:
    Male
    Location:
    Singapore
    Country Flag:
    IGN:
    Dynancix
    Level:
    14x
    Guild:
    Boobs
    Wow! This will be a nice feature indeed. :)
    Thanks!
     
  4. Gi
    Offline

    Gi Well-Known Member

    Joined:
    Mar 3, 2014
    Messages:
    451
    Likes Received:
    491
    Gender:
    Male
    IGN:
    Giceratops
    Level:
    30+
    Thank you Chok, very nice examples showing the options too. Also noticed [sub][/sub] and [sup][/sup] being added recently. Combined with the [anchor][/anchor] tag these will provide a great base to structure guides!
     
  5. Matt
    Offline

    Matt Administrator

    Joined:
    May 8, 2013
    Messages:
    14,646
    Likes Received:
    18,776
    Gender:
    Male
    Location:
    United Kingdom
    Country Flag:
    IGN:
    Matt
    Level:
    N/A
    Guild:
    Staff
    Thank you Chok, and very well explained too!
     
  6. Eli
    Offline

    Eli Well-Known Member

    Joined:
    Aug 26, 2013
    Messages:
    3,676
    Likes Received:
    15,455
    Location:
    ht n chill
    IGN:
    Hannako
    Level:
    200
    Guild:
    Oblivion
    Testing Table
    Testing Table
    Edit: Yay I got it ^^ ~~ Nice! :D
     
    xxTuzixx likes this.
  7. caladbolgftw
    Offline

    caladbolgftw Donator

    Joined:
    Jul 31, 2014
    Messages:
    148
    Likes Received:
    31
    Country Flag:
    IGN:
    bigbangsux
    ha, I learned that in web design class in college. Looks too similar.
     
  8. Saxa
    Offline

    Saxa Donator

    Joined:
    Feb 18, 2014
    Messages:
    312
    Likes Received:
    346
    IGN:
    Saxa
    Who the fuck is this?

    Also, more on-topic this time, thank you Chok. Very useful.
     
  9. Nedzad
    Offline

    Nedzad Well-Known Member

    Joined:
    Jun 16, 2014
    Messages:
    495
    Likes Received:
    201
    Gender:
    Male
    Location:
    Sweden
    Country Flag:
    IGN:
    Elint
    This is very neat, good job Chok!
     
  10. pokemon1188
    Offline

    pokemon1188 Well-Known Member

    Joined:
    Sep 5, 2014
    Messages:
    519
    Likes Received:
    208
    Gender:
    Female
    Country Flag:
    IGN:
    Mudkipz
    Level:
    120
    Guild:
    Oblivion
    +1 (y) GOOD JOB
     
  11. Katsuruka
    Offline

    Katsuruka Donator

    Joined:
    May 10, 2013
    Messages:
    10,977
    Likes Received:
    5,320
    Testing...

    Rank Name Styling Emblem
    Administrator Black GM Hat
    Assistant Admin Red GM Hat
    Out of curiosity, are table cell shading/colours supported?
     
    Last edited: Oct 13, 2014
  12. Chokladkakan
    Offline

    Chokladkakan Web Developer

    Joined:
    Feb 2, 2014
    Messages:
    421
    Likes Received:
    986
    It is now, using the bgcolor argument. The opening post has been updated accordingly.
     
    Tommy and Katsuruka like this.
  13. Tommy
    Offline

    Tommy Well-Known Member

    Joined:
    May 16, 2014
    Messages:
    335
    Likes Received:
    1,998
    How to Use Tables
    ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___
    ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___
    ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___
    ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___
    ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___
    ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___
    ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___
     
    Last edited: Oct 13, 2014
    Mooshy, Strategic, Graces and 5 others like this.
  14. Katsuruka
    Offline

    Katsuruka Donator

    Joined:
    May 10, 2013
    Messages:
    10,977
    Likes Received:
    5,320
    Wonderful, thank you very much, Chok!
     
  15. Chokladkakan
    Offline

    Chokladkakan Web Developer

    Joined:
    Feb 2, 2014
    Messages:
    421
    Likes Received:
    986
    The [th] and [td] tags now support a width argument, taking a percentage between 1% and 100%. They work best when the table width is specified, and they are sometimes wonky when used in conjunction with colspan. Be wary!

    The opening post has been updated in light of this.
     
    Katsuruka and Gi like this.
  16. Plenty
    Offline

    Plenty Well-Known Member

    Joined:
    Jun 11, 2014
    Messages:
    7,192
    Likes Received:
    7,770
    Gender:
    Male
    Location:
    California
    Country Flag:
    IGN:
    Plenty
    Level:
    200
    Guild:
    Hollywood
    @Chokladkakan
    Is there a limit to how many tables/columns you can make at once? I recently ran into a problem where whenever I add another row to the table with images, instead of the image popping up, I got this:

    [​IMG]

    This happened after I went through 17-18 rows. Any thoughts or solution?
     
  17. Chokladkakan
    Offline

    Chokladkakan Web Developer

    Joined:
    Feb 2, 2014
    Messages:
    421
    Likes Received:
    986
    I've no idea. Provide me with more information (or better yet, point me toward the table in question) so that I can have a go at recreating it, please.
     
  18. Plenty
    Offline

    Plenty Well-Known Member

    Joined:
    Jun 11, 2014
    Messages:
    7,192
    Likes Received:
    7,770
    Gender:
    Male
    Location:
    California
    Country Flag:
    IGN:
    Plenty
    Level:
    200
    Guild:
    Hollywood
    This is the table in question:
    http://royals.ms/forum/#25

    If I added like 2-3 more rows, the table won't show images anymore and it'll just post the URL. It might have to do with me not adding the [/tr] code after each row, but I just found it a bit weird.

    Also, I've heard some complaints on the resizing of tables and having them stretch too much on mobile and certain browsers. Any suggestions to fix that?
     
  19. Chokladkakan
    Offline

    Chokladkakan Web Developer

    Joined:
    Feb 2, 2014
    Messages:
    421
    Likes Received:
    986
    That link does not lead me to anywhere very informative.
     
  20. Plenty
    Offline

    Plenty Well-Known Member

    Joined:
    Jun 11, 2014
    Messages:
    7,192
    Likes Received:
    7,770
    Gender:
    Male
    Location:
    California
    Country Flag:
    IGN:
    Plenty
    Level:
    200
    Guild:
    Hollywood
Thread Status:
Not open for further replies.

Share This Page