18910140161

HTML-Text溢出省略号在CSS-Stack溢出中不起作用

顺晟科技

2022-10-19 12:49:26

127

我有下面的代码,我试图使用省略号,但它不起作用。

我想我需要给标题文本一些宽度,但我不确定应该是什么宽度,因为我需要它响应。

我正在尝试我的代码- https://www.w3schools.com/code/tryit.asp?filename=guqkrvts14f1


顺晟科技:

您在

上缺少

只需为标题容器添加最大宽度,这样它就不会溢出。

通过添加此选项,您的问题将得到解决。

以下是工作代码段

codepenhere

以下是最精确的答案,响应性强,且与文本无关:

.c-vis__head-section {
  padding: 32px 60px 30px 32px;
  border-bottom: 2px solid #ddd;
  border-left: 4px solid transparent;
}

.c-vis__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  gap: 20px;
}

.c-vis__head-left {
  display: flex;
  align-items: center;
  justify-content: end;
}

.c-vis__number {
  width: 36px;
  height: 35px;
  justify-content: center;
  display: flex;
  align-items: center;
  margin-right: 25px;
  color: #333;
}

.c-vis__head-text {
  font-size: 20px;
  font-weight: normal;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.c-vis__duration {
  font-size: 16px;
  color: red;
}

  • TAG:
相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航