小编Mon*_*ato的帖子

当文本为多行时如何去除多余的空间

我正在写一个徽章式的块。

问题在于第三个块 ( 1 (Something something)),正如您在代码段中看到的,它溢出到下一行并在右侧留下额外的空间。

此问题的图片与帖子中描述的相同

我应该怎么做才能摆脱那个空间?

如果它是纯 CSS 并且不涉及 jQuery,那就太好了。

谢谢!


section {
  width: 8rem;
}

div {
  margin-top: 1rem;
}

.outer {
  background: blue;
  display: inline-flex;
  color: white;
  font-family: Helvetica, Arial, sans-serif;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  min-width: 32px;
}
Run Code Online (Sandbox Code Playgroud)
<section>
  <div class="outer">
    1
  </div>

  <div class="outer">
    Very very very long Textttttt
  </div>

  <div class="outer">
    1 (Something something)
  </div>

  <div class="outer">
    Test
  </div>
</section>
Run Code Online (Sandbox Code Playgroud)

html css

5
推荐指数
0
解决办法
383
查看次数

Vue:使用范围时 CSS 不适用于 D3 的 svg

这是我的组件的代码:

<template>
  <div id="something" class="card">
  </div>
</template>
Run Code Online (Sandbox Code Playgroud)
const height = 200;
const width = 200;

let graph = d3
  .select('#something')
  .append('svg')
    .attr('class', 'chart-container')
    .attr('height', height)
    .attr('width', width);
Run Code Online (Sandbox Code Playgroud)
<style lang="scss" scoped>
.chart-container {
  background-color: aquamarine;
}
</style>
Run Code Online (Sandbox Code Playgroud)

svg 确实应用了类.chart-container,但没有应用样式

检查工具的图像

但是,当我scoped从 中删除时<style lang="scss">,它就起作用了。

代码按预期工作时检查工具的图像

为什么它会这样?

javascript css svg d3.js vue.js

5
推荐指数
1
解决办法
1096
查看次数

标签 统计

css ×2

d3.js ×1

html ×1

javascript ×1

svg ×1

vue.js ×1