I have a table which is responisve kind . The issue is if the column header name is big, its not wrapping and its over lapping.
Below is the screenshot and code HTML and CSS Checked style="word-wrap: break-word" and table-layout: fixed; width: 100%. But still it is not wrapping up. Any idea what we can change to fox this issue.
This page i am trying to see it in mobile.
<!DOCTYPE html>
<html>
<head>
<style>
@media only screen and (max-width: 760px),
(min-device-width: 768px) and (max-device-width: 1024px) {
table {
width: 100%;
}
/* Force table to not be like tables anymore */
table,
thead,
tbody,
th,
td,
tr {
display: block;
}
/* Hide table headers (but not display: none;, for accessibility) */
thead tr {
position: absolute;
top: -9999px;
left: -9999px;
}
tr {
border: 2px solid rgb(176 173 171);
}
td {
/* Behave like a "row" */
border: none;
/*border-bottom: 1px solid #eee; */
position: relative;
padding-left: 34%;
}
td:before {
/* Now like a table header */
position: absolute;
/* Top/left values mimic padding */
top: 6px;
left: 6px;
width: 45%;
padding-right: 10px;
white-space: nowrap;
/* Label the data */
content: attr(data-column);
border-color: darkgrey !important;
color: #000;
font-weight: bold;
word-wrap: break-word;
}
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<th>Action</th>
<template for:each={columns} for:item="col">
<th key={col.label} scope="col" style="word-wrap: break-word;">
<span class="slds-truncate">{col.label}</span>
</th>
</template>
</tr>
</thead>
<tbody>
<tr key={row.Id} class="slds-m-top_xx-small">
<td scope="row" data-column="Actionnnnnnnnnnnnnnnnnnn" data-id={row.Id}>
Test
</td>
<td scope="row" data-column="Name">
Test1
</td>
<td scope="row" data-column="Shipping Address">
Test2
</td>
<td scope="row" data-column="Industry">
Test4
</td>
<td scope="row" data-column="Phone">
Test3
</td>
</tr>
</tbody>
</table>
</body>
</html>

