简体   繁体   English

JavaScript,CSS:Clip在父DIV中

[英]JavaScript, CSS: Clip to be inside parent DIV

Context 上下文

I have a bunch of nested DIVs (implementing a simple window system, for learning purposes, with DIVs). 我有一堆嵌套的DIV(实现一个简单的窗口系统,用于学习目的,使用DIV)。

Problem: 问题:

Let divA = child of divB. 设divA = divB的子节点。

Now, ideally, I want the contents of divA to be "clipped" inside of divB. 现在,理想情况下,我希望divA的内容在divB中被“剪切”。

Thus, if I take divA, and drag it to the right ... as it gets out of the border of divB, I want the parts of divA that are outside of divB to be chopped off and not displayed. 因此,如果我使用divA,并将其向右拖动...当它离开divB的边界时,我希望divB之外的divA部分被切断而不显示。

Question: 题:

How do I do this? 我该怎么做呢? How do I use one div to clip / mask another div? 如何使用一个div剪辑/屏蔽另一个div?

Thanks! 谢谢!

It's called: 它被称为:

.divA {
    overflow: hidden;
}

w3 schools w3学校

Use the css overflow property. 使用css overflow属性。 Follow this link to see what values there are for overflow 请点击此链接查看overflow

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM