提问者:小点点

文本换行,css


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

换行不起作用在div中溢出

null

.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>

null


共1个答案

匿名用户

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

null

.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>