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 6870855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:44:03+00:00 2026-05-27T03:44:03+00:00

<table id="tab"> <tr><td class="sub">mmmmm</td><td class="sub">jjjjj</td></tr> <tr><td class="sub">lllll</td><td class="sub">wwwww</td></tr> </table> #tab td { border: 1px

  • 0
<table id="tab">
    <tr><td class="sub">mmmmm</td><td class="sub">jjjjj</td></tr>
    <tr><td class="sub">lllll</td><td class="sub">wwwww</td></tr>
</table>

#tab td {
  border: 1px solid green;
  max-width: 40px;
}

$(".sub").each(function(){
    var o = $(this).html();
    $(this).html(o.substring(0, 2))
})

LIVE EXAMPLE: https://jsfiddle.net/UTYLf/1/

i would like max-width for TD – 40px. i would like cut overflow text. I made substring but this is not usefriendly.
mm != ll and jj != ww etc. mm and ll has 2 chars, but mm takes more space than a ll.
In my example i would like have in table same as in this example: https://jsfiddle.net/Eb6WN/

what I must use instead of substr()?
I can use HTML, CSS, JavaScript (jQuery) and PHP

  • 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-27T03:44:04+00:00Added an answer on May 27, 2026 at 3:44 am

    In these types of situations I use overflow: hidden as well as adding a title for each cell to display the complete text:

    #tab td {
        border: 1px solid green;
        max-width: 40px;
        overflow: hidden;
    }
    
    $(".sub").each(function(){
        $(this).attr("title", $(this).text()).css("cursor", "help");
    })
    

    https://jsfiddle.net/hunter/UTYLf/4/

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

Sidebar

Related Questions

<html> <style type="text/css"> .table { display: table;} .tablerow { display: table-row; border:1px solid black;}
<table width="300" height=100 cellspacing="1" cellpadding="2" border="1"> <tbody> <tr> <td width="150" colspan="2" ></td> <td width="75"
Using JavaScript, how do I create an HTML table that can "accept" numeric matrix
I learned to use "exists" instead of "in". BAD select * from table where
I have the following Python code: cursor.execute("INSERT INTO table VALUES var1, var2, var3,") where
Table: UserId, Value, Date. I want to get the UserId, Value for the max(Date)
I have a Tab-delimited String (representing a table) that is passed to my method.
How do I pull data (string) from a column called "Limit" in a table
I have got a table structure which is as follows: `CREATE TABLE "pages" (
I have a database where one table "Common" is referenced by several other tables.

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.