在表格单元格中垂直对齐图标,该图标还包含文本,而不会使列明显变宽

如何解决在表格单元格中垂直对齐图标,该图标还包含文本,而不会使列明显变宽

我有下表,它只是示例,我可以在短时间内通知。我的问题在第四栏中,我有一个图标,一些文字,然后是另一个图标。这是我要找的东西:

  • 我希望第一个图标和文本像现在一样向左对齐。
  • 我希望第二个图标始终在各行之间垂直对齐。
  • 我希望第二个图标始终位于该行中最长的文本行的结尾处,如果文本太长,则不要与该文本重叠。
  • 即使文本中的数字为6或7位数字且窗口太窄以至于当前实现由于填充而将第二个图标推到第二行,这也应该起作用。 例如,下图是缩小窗口范围时的当前实现。除非没有其他选择,否则我不希望图标被包裹在下一行。

enter image description here

我尝试了几种选择:

  • 当前实施;
  • position:图标的绝对位置,position:相对于带有填充的单元格的相对位置(有效,但不适用于狭窄的窗口。第一幅图像未填充,第二幅图像具有填充);

enter image description here

enter image description here

  • 位置:相对图标的右侧:100px;

enter image description here

我不确定我还能尝试什么。这是一个棘手的问题,我已经与我们的网页设计师讨论过,但是由于技术原因,他无法自己看代码。我的目标实质上是,文本和图标之间的空间应保持相对较短,图标垂直对齐,如果窗口需要减小表格的宽度,则右边的空间应缩小。

/* ==========================================================================
 # WIZARD
 ========================================================================== */


/**
 * 1. c-wizard: components for wizards,e.g. "Phase Mass Replace".
 *
 */


/* BEM Blocks
 ========================================================================== */

.c-desktop {
  border-collapse: collapse;
  border-spacing: 0;
}

.c-desktop-association {}


/* BEM Elements & modifiers
 ========================================================================== */

.c-desktop .c-table-display__header {
  border: 1px solid #fff;
  border-bottom: 2px solid #a6a2a3;
  background-color: #f3f7fc;
  color: #263340;
  background-image: none;
  font-weight: bold;
  font-weight: normal;
  overflow: hidden;
  word-break: normal;
}

.c-desktop .c-desktop-association__association-item-cell {
  border-color: inherit;
  text-align: left;
  vertical-align: top;
  overflow: hidden;
  word-break: normal;
}

.c-desktop-association {
  border-top: 3px solid #a6a2a3;
}

.c-desktop-association tr:last-child {
  border-bottom: 2px solid #a6a2a3;
}


/*Hoogte instellen via "line-height"*/

.c-desktop .c-desktop-association:after {
  content: "-";
  visibility: hidden;
  display: table-row-group;
  line-height: 0.25;
}

.c-desktop-association__association-item {
  background-color: #f3f7fc;
  color: #263340;
  font-size: 12px;
  font-weight: normal;
  height: 20px;
  text-align: left;
}

td.c-desktop-association__association-item-cell {
  font-variant: normal;
  font-weight: normal;
  font-size: 11px;
  text-align: left;
  padding: 4px 4px 4px 4px;
  vertical-align: top;
  border-top: 1px solid #a6a2a3;
  color: #263340;
  vertical-align: middle;
  overflow: hidden;
  word-break: normal;
}

td.c-desktop-association__association-type,td.c-desktop-association__remove-association {
  font-variant: normal;
  font-size: 11px;
  text-align: left;
  padding: 4px;
  height: 100%;
  border: 0px;
  color: #263340;
}

.c-desktop .c-desktop-association__association-item-cell--latest {
  box-sizing: border-box;
}

.c-desktop-association__association-item-related-icon {
  float: right;
  padding-right: 100px;
  box-sizing: border-box;
}

.u-width-full {
  width: 100%;
}
<table class="c-desktop c-table-display u-width-full" id="desktopAssociationTable">
  <thead>
    <tr>
      <th class="c-table-display__header">Type</th>
      <th class="c-table-display__header">Level</th>
      <th class="c-table-display__header">Active Build</th>
      <th class="c-table-display__header">Latest</th>
      <th class="c-table-display__header">Latest Success</th>
      <th class="c-table-display__header">Next</th>
      <th class="c-table-display__header">Action</th>
      <th class="c-table-display__header">Message</th>
      <th class="c-table-display__header"></th>
    </tr>
  </thead>
  <tbody class="dojoDndItem c-desktop-association" id="1" dnddata="277">
    <tr class="c-desktop-association__association-item c-desktop-association__association-item--odd">
      <td class="dndSubrow c-desktop-association__association-item-cell c-desktop-association__association-type">
        <b>Level: </b> COMMON / H_1-0
      </td>
      <td class="dndSubrow c-desktop-association__association-item-cell">

        CONTBUILD
      </td>
      <td class="dndSubrow c-desktop-association__association-item-cell">
        228
      </td>
      <td class="dndSubrow c-desktop-association__association-item-cell c-desktop-association__association-item-cell--latest">
        <img src="https://i.stack.imgur.com/n7Ycz.jpg?s=16&g=1" title="Success">
        <a href="/alm/levelRequestDetails.action?levelRequestOid=1268">1268</a>&nbsp;[8/21/20,1:04 PM] &nbsp;
        <a href="/alm/levelRequestOverviewDisplay.action?searchView.projectName=COMMON&amp;searchView.projectStreamBuildPrefix=1-0&amp;searchView.projectStreamBuildSuffix=&amp;searchView.levelName=CONTBUILD&amp;searchView.showHiddenPackages=-1&amp;searchView.showHiddenProjectStreams=-1"><img class="c-desktop-association__association-item-related-icon" src="https://i.stack.imgur.com/n7Ycz.jpg?s=16&g=1" title=""></a>
      </td>
      <td class="dndSubrow c-desktop-association__association-item-cell">
        <img src="https://i.stack.imgur.com/n7Ycz.jpg?s=16&g=1" title="Success">
        <a href="/alm/levelRequestDetails.action?levelRequestOid=1268">1268</a>&nbsp;[8/21/20,1:04 PM]

      </td>
      <td class="dndSubrow c-desktop-association__association-item-cell">
        9/24/19,2:30 PM
      </td>
      <td class="dndSubrow c-desktop-association__association-item-cell">
        <a href="displayLevelRequestCreate.action?createMode=request&amp;projectStreamOid=2&amp;levelOid=4&amp;packageOid=" class="c-table-display__action-icon"><img src="https://i.stack.imgur.com/n7Ycz.jpg?s=16&g=1" title="Request"></a>
      </td>
      <td class="dndSubrow c-desktop-association__association-item-cell">

      </td>
      <td class="dndSubrow c-desktop-association__association-item-cell c-desktop-association__remove-association js-remove-selected-rows-node">
        <img src="https://i.stack.imgur.com/n7Ycz.jpg?s=16&g=1" title="Remove">
      </td>
    </tr>
  </tbody>
  <tbody class="dojoDndItem c-desktop-association" id="1" dnddata="277">
    <tr class="c-desktop-association__association-item c-desktop-association__association-item--odd">
      <td class="dndSubrow c-desktop-association__association-item-cell c-desktop-association__association-type">
        <b>Level: </b> COMMON / H_1-0
      </td>
      <td class="dndSubrow c-desktop-association__association-item-cell">

        CONTBUILD
      </td>
      <td class="dndSubrow c-desktop-association__association-item-cell">
        228
      </td>
      <td class="dndSubrow c-desktop-association__association-item-cell c-desktop-association__association-item-cell--latest">
        <img src="https://i.stack.imgur.com/n7Ycz.jpg?s=16&g=1" title="Success">
        <a href="/alm/levelRequestDetails.action?levelRequestOid=1268">1268</a>&nbsp;[8/21/20,2:30 PM
      </td>
      <td class="dndSubrow c-desktop-association__association-item-cell">
        <a href="displayLevelRequestCreate.action?createMode=request&amp;projectStreamOid=2&amp;levelOid=4&amp;packageOid=" class="c-table-display__action-icon"><img src="https://i.stack.imgur.com/n7Ycz.jpg?s=16&g=1" title="Request"></a>
      </td>
      <td class="dndSubrow c-desktop-association__association-item-cell">

      </td>
      <td class="dndSubrow c-desktop-association__association-item-cell c-desktop-association__remove-association js-remove-selected-rows-node">
        <img src="https://i.stack.imgur.com/n7Ycz.jpg?s=16&g=1" title="Remove">
      </td>
    </tr>
  </tbody>
</table>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-