Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Adjust Table into CSS based on Device Width

Adjust Table into CSS based on Device Width

Scheduled Pinned Locked Moved Web Development
csscomquestionannouncement
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jassim Rahma
    wrote on last edited by
    #1

    Hi, I have a table with the following columns: Status Paid category From To Total Days It's shown perfectly on desktop but I want to adjust the width or the layout of it on mobile I am using:

    @media all and (max-width: 414px) and (min-width: 375px)

    but I am not sure what to set there for Tables and what's the the best way to do it? Thanks, Jassim[^]

    Technology News @ www.JassimRahma.com

    J E 2 Replies Last reply
    0
    • J Jassim Rahma

      Hi, I have a table with the following columns: Status Paid category From To Total Days It's shown perfectly on desktop but I want to adjust the width or the layout of it on mobile I am using:

      @media all and (max-width: 414px) and (min-width: 375px)

      but I am not sure what to set there for Tables and what's the the best way to do it? Thanks, Jassim[^]

      Technology News @ www.JassimRahma.com

      J Offline
      J Offline
      Jassim Rahma
      wrote on last edited by
      #2

      Hi, I found this article: https://css-tricks.com/responsive-da...#comment-91835[^] it's really excellent but I have a question please. using the CSS mentioned in the article will turn all my TDs and TRs which is good except this part:

      td:nth-of-type(1):before { content: "Status"; }
      td:nth-of-type(2):before { content: "Paid"; }
      td:nth-of-type(3):before { content: "Category"; }
      td:nth-of-type(4):before { content: "From"; }
      td:nth-of-type(5):before { content: "To"; }
      td:nth-of-type(6):before { content: "Total Days"; }

      because there are different tables in every page so how can I tell the CSS which titles to use for which table? Thanks, Jassim[^]

      Technology News @ www.JassimRahma.com

      1 Reply Last reply
      0
      • J Jassim Rahma

        Hi, I have a table with the following columns: Status Paid category From To Total Days It's shown perfectly on desktop but I want to adjust the width or the layout of it on mobile I am using:

        @media all and (max-width: 414px) and (min-width: 375px)

        but I am not sure what to set there for Tables and what's the the best way to do it? Thanks, Jassim[^]

        Technology News @ www.JassimRahma.com

        E Offline
        E Offline
        Erick Shawn
        wrote on last edited by
        #3

        Hi there, Enter this CSS code to make your table responsive for mobile websites. https://css-tricks.com/responsive-data-tables/[^]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups