Hi there,
I want to talk only html (and css) . will go to xojo implementation once it works in html
take this html code :
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bootstrap Table with Limited Row Height</title>
<!-- Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<style>
.table tbody tr td {
max-height: 100px;
min-height: 10px;
overflow: hidden;
white-space: normal;
text-overflow: ellipsis;
}
</style>
</head>
<body>
<div class="container">
<h2>Bootstrap Table with Limited Row Height</h2>
<table class="table table-striped" style="border: 1px solid;">
<thead>
<tr>
<th>#</th>
<th>Column 1</th>
<th>Column 2</th>
<!-- Add more columns if needed -->
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td><div class="cell-content">Row 1 Data 1</div></td>
<td><div class="cell-content">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed justo sapien, pulvinar efficitur iaculis eget, aliquam at neque. Nulla consectetur purus non mauris dictum, vitae pretium lacus accumsan. Phasellus vehicula sem nisi, in maximus elit fermentum eget. In et ligula tortor. Sed dictum diam nulla, quis iaculis lectus volutpat sed. Proin lobortis nunc sem, in condimentum purus ultrices a. Morbi consectetur feugiat orci, at placerat diam pretium vel. In finibus lacus sed leo gravida feugiat eget at lorem. Donec orci erat, mollis vel tristique a, dapibus dapibus ante. Donec est nulla, vulputate ac vehicula eget, vehicula ut libero.
</div></td>
<!-- Add more data cells if needed -->
</tr>
<tr>
<td>2</td>
<td><div class="cell-content">Row 2 Data 1</div></td>
<td><div class="cell-content">Row 2 Data 2</div></td>
<!-- Add more data cells if needed -->
</tr>
<!-- Add more rows if needed -->
</tbody>
</table>
</div>
</body>
</html>
I would like to display only some lines (3 or anything in pixels if easier) of the first row, as it is too big to display, and display some text ellipsis at the end to tell itās partially displayed.
the tag in the header should do it, the āmax-heightā in particular, but I canāt make it works.
Iām pretty sure I miss something simple, but cannot figure it.
and the <TD> in the browser becomes <td scope="row" style="-webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; width: 150px; text-align: center;">30/04/2024</td>
is it because I have a display:block in the tbody just before ? <tbody id="SJwnO7_body" style="overflow: visible scroll; display: block; height: 846px;">
the ā;ā extra was the reason while the display style did not get to the TD
now itās here <td style="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; width: 381.15px; text-align: left;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed justo sapien, pulvinar efficitur iaculis eget, aliquam at neque. Nulla consectetur purus non mauris dictum, vitae pretium lacus accumsan. In finibus lacus sed leo gravida feugiat eget at lorem. Donec orci erat, mollis vel tristique a, dapibus dapibus ante. Donec est nulla, vulputate ac vehicula eget, vehicula ut libero.</td>
@Thomas_Kaltschmidt1 where did you get this css ? is there an article explaining how to use it ?
I still have my whole table not looking good, althought the 3 lines and the ellipsis for the too long text are working.
do I have to have the whole table with a certain style, or only the TD is enough ?
thanks.
I searched web but at least found this info via ChatGPT. Then tried it out in different browsers with your provided sample and it seemed to work. Do you have issues in a standalone browser or in the xojo embedded?
May it makes a difference if you style inline or via css?
thanks everyone.
the html sample works fine, but now Iām trying to install it in my websdk table
and it gives the example aboveā¦
I have some other styles on the thead, tbody (and tfooter) and I think it may come from that
so I was searching for some complete article online that explains how this css works.
ā¦
will have to do some more experiments on itā¦
EDIT: itās not the āverticalā as it is mandatory to make the webkit-box work.
I tried the webkit-inline-box, it looks better but itās still not as it should ā¦