javascript - 如何使文本对齐适用于强标签?

标签 javascript html css

我正在尝试证明 <strong> 中的文本合理标签。我已添加strong {text-align: justify;}这不起作用。这是我尝试运行此示例的链接。 https://codepen.io/vkdatta27/pen/abNQeoL 。我还添加了strong {font-weight: normal;}这奏效了。只有文本对齐可以提供帮助。我不想 html 被改变一点点。我只想改变CSS。有人可以帮我解决这个问题吗?我的前两个问题也与此问题有关,但由于没有最低限度的详细信息,因此它们已关闭。我认为上面的链接给了你足够的要求。

最佳答案

添加display: inline-block;强而不是font-weight: normal;工作完美:)

Because, <strong> is an inline element per default. Meaning it has no width or height on its own but rather is exactly as big as its content. So you can try to add display property inline-block or block.

strong {
    text-align: justify;
    display: inline-block;// also works with display:block
}

strong {
  text-align: justify;
  display: inline-block;
}
think I have more power than he does. I think I could string together the wrestling and the grappling and the striking better than he can, and it will be the best fight
<br /><br />
<strong>WBC heavyweight champion Tyson Fury has applied pressure on his domestic rival, Anthony Joshua, to bypass any further obligations that stand in the way of a 2021 showdown.

  Fury is going to face Deontay Wilder in a trilogy fight on the tentative date of December 19.</strong>

关于javascript - 如何使文本对齐适用于强标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64005490/

相关文章:

javascript - CSS 如何在内部处理图像操作?

html - CSS 动态最大宽度

Css 网格布局列问题

php - 从php文件+ajax获取数据

javascript - 是否可以检查 `10.0` 在 javascript 中是 float 还是 int?

javascript - 如何显示每个图像上传的上传进度

html - iFrame 上的 Overflow-y 不显示滚动条

html - 我的 CSS 可以在所有浏览器中使用,但不能在 ie8 中使用,它的布局很奇怪并且显示错误

html - 滚动文本区域时防止出现 "half cut"行

javascript - 选择具有特定类名的元素