html - 在文本区域文本到达另一个元素之前将其打断

标签 html css

我有一个文本区域,我希望文本在它与作为我的 html 文件中的按钮的表情符号图标重叠之前中断。我不想让它重叠。我宁愿不给表情符号 z-index 因为它会把其他事情搞砸。

这是代码

HTML

<button class="emoji"></button>
<textarea rows="6" cols="60" class="divTxtArea" placeholder="Type a message.."></textarea>

CSS

.divTxtArea
{

    resize: none;
    font-family: "Open Sans";
    font-size: 1em;
    color:#8b959a;
    border-radius: 5px;
    border:1px solid #e1e4e6;
    width:580px;
    padding:15px 20px;
    height:180px;
    max-height:180px;
    overflow-y:scroll;
    outline: none; 
    resize:none!important;
}

div .emoji
{
    position:absolute;
    left:80%;
    margin-top:10px;
    display:inline-block;
}

给不懂的 friend 上个图

enter image description here

最佳答案

试试这个

.divTxtArea
{

    resize: none;
    font-family: "Open Sans";
    font-size: 1em;
    color:#8b959a;
    border-radius: 5px;
    border:1px solid #e1e4e6;
    width:580px;
    padding:15px 20px;
    height:180px;
    max-height:180px;
    overflow-y:scroll;
    outline: none; 
    resize:none!important;
}

.divTxtArea .emoji
{
    float: right;
    margin-top:10px;
    display:inline-block;
}

.divTxtArea textarea {

  border: none;
  width : 95%;
  height: 100%;
  
}
<div class="divTxtArea">
  <button class="emoji"></button>
<textarea rows="6" cols="60" placeholder="Type a message.."></textarea>
  </div>

关于html - 在文本区域文本到达另一个元素之前将其打断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36011252/

相关文章:

javascript - 我的 circle-divs 不工作。为什么?

javascript - 使元素不影响页面高度(从而滚动)

html - 在圆圈内正确对齐文本

javascript - 用 Canvas 绘制 Javascript

html - 仅使用 HTML 和 CSS 跨多个站点的菜单列表

jquery - 在悬停时在传单 map 上添加图像

javascript - 如何防止Android浏览器上的键盘改变页面的高度?

html - 如何使背景视频响应?

javascript - 如何为表格元素提供单独的值以在 HTML 中右键单击

javascript - 带有固定内容 block 的侧边栏固定面板