Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Smartphone Table

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #192861
    analis
    Participant

    You can turn a table with 4 columns in a table from 2 columns using a new external css? without adding new code in html page

    Start:

    <table>
    <tr><td></td><td></td><td></td><td></td></tr>
    </table>

    Result:

    <table>
    <tr><td></td><td></td></tr>
    <tr><td></td><td></td></tr>
    </table>

    #192875
    Paulie_D
    Member

    If you are asking if it’s possible (it’s not clear) with CSS, then the answer is NO.

    CSS can only style HTML not create new elements.

    Also, if you think about it logically this would destroy the reason for using a table in the first place.

    You are using it to display tabular data aren’t you?

    #192876
    analis
    Participant

    sorry for my english

    with this code transform a table of 4 columns in a table by 1 column only, but I need 2 columns

    table td{display:block; overflow-x: auto;}
    #192879
    Senff
    Participant

    In your original post you say “without adding new code to the HTML page” but in your Start and Result code examples, there IS new code…so that’s a little contradictory.

    Having said that, you could do something like this, but that may not be in the order you like to see the cells:

    http://codepen.io/senff/pen/rajqbE

    #192881
    analis
    Participant

    My example was wrong sorry.

    the data in my table so in alphabetical order

    <tr>
    <td>a</td><td>b</td><td>c</td><td>d</td>
    </tr>
    <tr>
    <td>e</td><td>f</td><td>g</td><td>h</td>
    </tr>

    I have 500 tables can not change code, are desperate!

    #192890
    Senff
    Participant

    Something like this then?

    http://codepen.io/senff/pen/KwabPd

    #192893
    analis
    Participant

    fantastic work!

    last problem, some cells of the table are empty, how can I display only the border?

    <td>A</td><td>B</td>
    <td>C</td><td> </td>

    #192898
    analis
    Participant

    you can delete the blank cells without leaving empty space ?

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘CSS’ is closed to new topics and replies.