如何在文本中的每行右侧覆盖difs

发布于 2025-01-29 01:38:56 字数 666 浏览 3 评论 0原文

我想在用户键入这样的文本方面的每行右键文本:

“

它也应该支持这样的滚动(请参阅视图时如何切断顶部?):):):

我该怎么做?

编辑:

另外,右侧的任何DIV都应在悬停时进行动画动画,然后单击时,内容应复制到剪贴板上。像这样:

I want to right-align text to each line in a textarea that a user is typing like this:

Numi screenshot

It should also support scrolling like this (see how the top is cut off when it's out of view?):

Scrolled numi screenshot

How might I go about doing that?

EDIT:

Also, any div on the right should animate on hover and when clicked, the contents should be copied to clipboard. Like so:

Align right hover and click

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

动听の歌 2025-02-05 01:38:56

只需在两个不同的文本区域中放置一个,然后将一个区域放在左和第二到右。然后使它们在视觉上看起来像一个:左MAKE 边界右翼:0; for-righ- border-left:0;

对于您的任务,您可以使用textereadiv这样:

* {
  margin: 0;
  padding: 0;
}

.textarea-block {
  box-sizing: border-box;
  display: inline-block;
  border: 1px solid #eee;
  padding: 10px;
  width: 400px; /* Here you could use % or wh to make it looks better in your app */
}

/* Don't forget to make a clearfix after floats */
.textarea-block:after {
  content: '';
  clear: both;
}

.left {
  font-family: Arial;
  font-size: 16px;
  border: 0;
  width: 50%;
}

.right {
  font-family: Arial;
  font-size: 16px;
  display: inline-block;
  text-align: right;
  width: 50%;
  float: right;
}
<div class="textarea-block">
  <textarea name="" cols="30" rows="10" class="left">First line 
Second line</textarea>
  <div class="right">
    First line <br>Second line
  </div>
</div>

只需确保将相同的font-sizefont-family to textarea和div进行,以使文本看起来相同。

Just make two different text areas and put one at left and second to right. Then make them look visually like one: for left make border-right: 0; for right - border-left: 0;

For your task you could use texterea and div like that:

* {
  margin: 0;
  padding: 0;
}

.textarea-block {
  box-sizing: border-box;
  display: inline-block;
  border: 1px solid #eee;
  padding: 10px;
  width: 400px; /* Here you could use % or wh to make it looks better in your app */
}

/* Don't forget to make a clearfix after floats */
.textarea-block:after {
  content: '';
  clear: both;
}

.left {
  font-family: Arial;
  font-size: 16px;
  border: 0;
  width: 50%;
}

.right {
  font-family: Arial;
  font-size: 16px;
  display: inline-block;
  text-align: right;
  width: 50%;
  float: right;
}
<div class="textarea-block">
  <textarea name="" cols="30" rows="10" class="left">First line 
Second line</textarea>
  <div class="right">
    First line <br>Second line
  </div>
</div>

Just be sure to make the same font-size and font-family to textarea and div to make text looks same.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文