Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6041703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:42:00+00:00 2026-05-23T06:42:00+00:00

I want to make this table http://jsfiddle.net/B7SVK/ from 4 column to single column because

  • 0

I want to make this table http://jsfiddle.net/B7SVK/ from 4 column to single column because I need to convert this table from Desktop to Mobile website and mobile device has limited width. and I don’t want horizontal scrolling in webpage.

So is there a way to convert this 4 column table into single column table while maintaining the accessibility and association between relevant data cells and heading

  <table>
        <caption>
        Contact Information
        </caption>
<thead>
        <tr>
                <th scope="col">Name</th>
                <th scope="col">Phone#</th>
                <th scope="col">Fax#</th>
                <th scope="col">City</th>
        </tr>
</thead>
<tbody>
        <tr>
                <th scope="row">Joel Garner</th>
                <td>412-212-5421</td>
                <td>412-212-5400</td>
                <td>Pittsburgh</td>
        </tr>
        <tr>
                <th scope="row">Clive Lloyd</th>
                <td>410-306-1420</td>
                <td>410-306-5400</td>
                <td>Baltimore</td>
        </tr>
        <tr>
                <th scope="row">Gordon Greenidge</th>
                <td>281-564-6720</td>
                <td>281-511-6600</td>
                <td>Houston</td>
        </tr>
</tbody>
</table>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:42:00+00:00Added an answer on May 23, 2026 at 6:42 am

    You can completely re-style a table by changing all the elements inside a table to display: block; e.g.

    table, thead, tbody, tr, th, td {display: block; text-align: left;}
    

    that’s just a broad sweep, as you can just as well have some of them display: inline; or float as if they were non-table elements.. it depends on what you want your single column to look like.

    and maybe generated content would help regards table headings (visual associations).. i.e. by hiding the <th> elements and generating the "heading" before the "cell" content.. will try to make a sample fiddle

    Example JSFiddle

    Code in fiddle:

    html, body {margin: 0; padding: 0;}
    
    table, thead, tbody, tr, th, td {display: block; text-align: left;}
    
    thead {display: none;}
    
    td:before {
    float: left;
    width: 200px;
    background: #eee;
    }
    
    td {overflow: hidden;}
    
    td:before {content: "Item";}
    td+td:before {content: "Price (Euro)";}
    td+td+td:before {content: "Postage and Packaging (Euro)";}
    td+td+td+td:before {content: "Estimated Delivery Time";}
    

    HTML: note I put the header row into a <thead> so it can be hidden

    <table class="single-borders">
      <thead>
        <tr><th>Item</th><th>Price (Euro)</th><th>Postage and Packaging (Euro)</th><th>Estimated Delivery Time</th></tr>
      </thead>
      <tbody>
       <tr><td>Rocking Horse</td><td>€&nbsp;40.00</td><td>€&nbsp;20</td><td>3 working days</td></tr>
       <tr><td style="color:#666">Princess Costume *</td><td>€&nbsp;20.00</td><td>€&nbsp;5</td><td>Next day if ordered before 12.00</td></tr>
       <tr><td>Soldier Uniform</td><td>€&nbsp;20.00</td><td>€&nbsp;5</td><td>Next day if ordered before 12.00</td></tr>
       <tr><td>Pink Roller Skates</td><td>€&nbsp;35.00</td><td>€&nbsp;10</td><td>Next day if ordered before 12.00</td></tr>
       <tr><td style="color:#666">Black Roller Skates *</td><td>€&nbsp;35.00</td><td>€&nbsp;10</td><td>Next day if ordered before 12.00</td></tr>
      </tbody>
    </table>
    

    Updated

    as per comments to change to single column of 176px;

    try this CSS:

    html, body {margin: 0; padding: 0;}
    
    table, thead, tbody, tr, th, td {display: block; text-align: left;}
    
    table {width: 176px;}
    
    thead {display: none;}
    
    tr {
     margin: 10px 0; 
     border: 1px solid #000;
    }
    
    td:before {
     display: block;
     background: #eee;
     font-weight: bold;
    }
    
    td:before {content: "Item";}
    td+td:before {content: "Price (Euro)";}
    td+td+td:before {content: "Postage and Packaging (Euro)";}
    td+td+td+td:before {content: "Estimated Delivery Time";}
    

    which changes the display to this:

    Updated Fiddle

    Once you realise you can style a table in this way, i.e. the same as any other element – you can pretty much make it look how you want 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make a dropdown menu like delicious has at this http://delicious.com/search?context=all&p=sql&lc=1 page.
i want to make my table can filtering in each column. i get client
I want to make a tableView like this: http://www.topappreviews101.com/ipappimg/4025/moma-ab-ex-ny-screenshot-3.jpg I created a horizontal table
I want to make this specialized w/o changing main. Is it possible to specialize
Let's make this very easy. What I want: @array = qw/one two one/; my
I want to make the line marked with // THIS LINE SHOULD BE PRINTING
I want to make a development server for Ruby. (I have done this for
This one has me kind of stumped. I want to make the first word
In there an easy way to do this in PHP. I want to make
I want to refactor this mumbo jumbo of a method to make it more

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.