Skip to content

overflow-wrap break-word vs anywhere #34

@kzhui125

Description

@kzhui125
image

If the value of width is something other than min-content, then break-word and anywhere will have the same results.

but in my testing, break-word and anywhere is different in table when width is auto, can you help

<!DOCTYPE html>
<html>

<head>
    <style>
        table {
            font-family: arial, sans-serif;
            border-collapse: collapse;
        }

        td,
        th {
            border: 1px solid #dddddd;
            text-align: left;
            padding: 8px;
        }

        td {
            width: auto;
            /* overflow-wrap: break-word; */
            overflow-wrap: anywhere;
        }

        tr:nth-child(even) {
            background-color: #dddddd;
        }
    </style>
</head>

<body>

    <h2>HTML Table</h2>

    <div style="width: 600px;">
        <table>
            <tr>
                <th>Column1</th>
                <th>Column2</th>
            </tr>
            <tr>
                <td>Centro comercial
                    MoctezumaMoctezumaMoctezumaMoctezumaMoctezumaMoctezumaMoctezumaMoctezumaMoctezumaMoctezumaMoctezumaMoctezuma
                </td>
                <td>Centro comercial
                    </td>
            </tr>
        </table>
    </div>


</body>

</html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions