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

  • SEARCH
  • Home
  • 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 6362101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:51:52+00:00 2026-05-24T23:51:52+00:00

I have a dynamic table that I generate after getting some inputs from the

  • 0

I have a dynamic table that I generate after getting some inputs from the user to present some tabular data. I need to know if there is away to assign a fixed height for the cells even if some of them have some content / text. I would like all the cells to have 30px height regardless if they have content or if they are empty.

This is the CSS I have:

table {
  width: 90%;
  height:100%;

}
    table th,  table td {
      border: 1px solid gray;
      height:30px !important;
      padding: 9px !important;
      width: 16%;
    }

The table is generated by this code:

foreach ( $this->rows as $i => $row ) {
            $tbody_tr = NHtml::el ('tr class="data-row-' . $i . '"');
            foreach ( $this->fields as $field ) {
                $tbody_tr->add(NHtml::el ('td')->class($field['name'])->setHtml(@$row[$field['name']]));
            }

But when I have a cell that has some text, the cell height expands anyway. Any ideas?

  • 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-24T23:51:52+00:00Added an answer on May 24, 2026 at 11:51 pm

    Table cells don’t overflow so you need to wrap the content in a div to use overflow

    Here is an example: http://jsfiddle.net/avVQm/

    HTML:

    <table>
     <tr>
      <td>
       <div>
        gf asfdg fsagfag fdsa gfdsg fdsg fds g fdg
       </div>
      </td>
     </tr>
    </table>
    

    CSS:

    table {
        width: 30px;
        border: 1px solid black;
    }
    
    table td > div {
        overflow: hidden;
        height: 15px;
    }
    

    Your PHP:

    foreach ((array)$this->fields as $field ) {
     $wrapperdiv = NHtml::el ('div');
     $tbody_tr->add($wrapperdiv);
     $wrapperdiv->add(NHtml::el ('td')->class($field['name'])->setHtml(@$row[$field['name']]));
    }
    

    Note that I don’t exactly know the syntax for the framework that you use, but I’d guess your php will look something like this.

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

Sidebar

Related Questions

I have some PHP code that generates dynamic tables of data on the fly.
I have a situation where I need to generate a table from a stored
I am using ASP.NET Dynamic Data for a project and I have a table
I have a Dynamic Data Entities Web Application that uses a database with GUIDs
I have a dynamic text file that picks content from a database according to
I'm getting into dynamic data sites (remarkably powerful), and enjoying it. However, I have
I have as a result from a dynamic query a table with only one
I am working with JSF/ICEFaces and I need to generate a table from a
I have a big json object containing cell data from a sample spreadsheet that
I have a table that gets a dynamic source list for each row, with

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.