首页 > 解决方案 > 文本换行,css

问题描述

文本换行问题。元素“.usser a”不换行,或者如果我在“.usser”中使用溢出,则此元素与 div 重叠,我看不到按钮。

包装在 div中不起作用 溢出

.usser button {
  background-color: transparent;
  width: 20px;
  height: 20px;
}

.usser {
  margin-left: 5px;
  margin-bottom: 5px;
  height: 25px;
  border-bottom: 1px solid red;
  margin-top: 25px;
}

.usser a {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usser div {
  float: right;
}
<div class="employee" id="employee">
  <div id="list">
    <p id="1" class="usser">
      <a>xxx</a>
      <div>
        <button></button>
        <button></button>
      </div>
    </p>

标签: htmlcss

解决方案


只需使用 div 标签而不是 p 段落。

.usser button {
  background-color: transparent;
  width: 20px;
  height: 20px;
}

.usser {
  margin-left: 5px;
  margin-bottom: 5px;
  height: 25px;
  border-bottom: 1px solid red;
  margin-top: 25px;
}
.usser a {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usser div {
  float: right;
}
<div class="employee" id="employee">
  <div id="list">
    <div id="1" class="usser">
      <a>xxx</a>
      <div>
        <button></button>
        <button></button>
      </div>
    </div>


推荐阅读