Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply badge border classes to child td instead of table (#254) #255

Closed

Conversation

maurojs10
Copy link

This is necessary to make border-radius work.

@maurojs10
Copy link
Author

The border classes should be applied to the child td element instead of the table element in the compiled HTML.

Source HTML

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  </head>
  <body class="bg-light">
    <span class="badge border border-danger text-danger">Test</span>
  </body>
</html>

Compiled HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <!-- Compiled with Bootstrap Email version: 1.4.1 --><meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="x-apple-disable-message-reformatting">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="format-detection" content="telephone=no, date=no, address=no, email=no">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">
      body,table,td{font-family:Helvetica,Arial,sans-serif !important}.ExternalClass{width:100%}.ExternalClass,.ExternalClass p,.ExternalClass span,.ExternalClass font,.ExternalClass td,.ExternalClass div{line-height:150%}a{text-decoration:none}*{color:inherit}a[x-apple-data-detectors],u+#body a,#MessageViewBody a{color:inherit;text-decoration:none;font-size:inherit;font-family:inherit;font-weight:inherit;line-height:inherit}img{-ms-interpolation-mode:bicubic}table:not([class^=s-]){font-family:Helvetica,Arial,sans-serif;mso-table-lspace:0pt;mso-table-rspace:0pt;border-spacing:0px;border-collapse:collapse}table:not([class^=s-]) td{border-spacing:0px;border-collapse:collapse}@media screen and (max-width: 600px){*[class*=s-lg-]>tbody>tr>td{font-size:0 !important;line-height:0 !important;height:0 !important}}
    </style>
  </head>
  <body class="bg-light" style="outline: 0; width: 100%; min-width: 100%; height: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; font-family: Helvetica, Arial, sans-serif; line-height: 24px; font-weight: normal; font-size: 16px; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; color: #000000; margin: 0; padding: 0; border-width: 0;" bgcolor="#f7fafc">
    <table class="bg-light body" valign="top" role="presentation" border="0" cellpadding="0" cellspacing="0" style="outline: 0; width: 100%; min-width: 100%; height: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; font-family: Helvetica, Arial, sans-serif; line-height: 24px; font-weight: normal; font-size: 16px; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; color: #000000; margin: 0; padding: 0; border-width: 0;" bgcolor="#f7fafc">
      <tbody>
        <tr>
          <td valign="top" style="line-height: 24px; font-size: 16px; margin: 0;" align="left" bgcolor="#f7fafc">
            <table class="badge text-danger" align="left" role="presentation" border="0" cellpadding="0" cellspacing="0" style="color: #dc3545;">
              <tbody>
                <tr>
                  <td class="border border-danger" style="line-height: 1; font-size: 75%; display: inline-block; font-weight: 700; white-space: nowrap; border-radius: 4px; color: #dc3545; margin: 0; padding: 4px 6.4px; border: 1px solid #dc3545;" align="center" valign="baseline">
                    <span>Test</span>
                  </td>
                </tr>
              </tbody>
            </table>
          </td>
        </tr>
      </tbody>
    </table>
  </body>
</html>

Result

image

@maurojs10
Copy link
Author

See issue #254.

@stuyam
Copy link
Member

stuyam commented Apr 28, 2024

This is being fixed in a different way in v1.5.0

@stuyam stuyam closed this Apr 28, 2024
@maurojs10
Copy link
Author

I'm afraid the problem with border-radius is still not fixed.

I've upgraded to v1.5.1 and the border is not rounded for me, unless I apply the changes proposed in this pull request.

I would appreciate it if you could reconsider this pull request, please.

@stuyam
Copy link
Member

stuyam commented Apr 29, 2024

This is the change that was added to apply the border radius to the td on .badges in v1.5.0. It is certainly possible it isn't working for some reason but this is the intended setup for how utility classes get applied to components.

@stuyam
Copy link
Member

stuyam commented Apr 29, 2024

I think the problem is the specificity of this is taking precedence of the "util apply for specificity".

.badge > tbody > tr > td {

Will have to update that in the selectores_for_utils class to follow the same arrow precedence and will also write some tests to make sure it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants