CSS样式未完全应用

huangapple go评论70阅读模式
英文:

CSS Style not being applied completely

问题

我正在尝试通过使用 right : -80px; 来裁剪嵌套在 iframe 中的网站的右侧。一切似乎都正常,但右侧的裁剪没有生效。

我已经尝试过:

  • rightleft 更改为 margin-rightmargin-left
  • 通过按 Ctrl+F5 来执行“完全刷新”浏览器
  • 尝试将值从 -80px 更改为不同的值,以查看是否有效
  • 使用 Edge 和 Firefox 进行测试
英文:

I am trying to crop the right side of the embedded website within the iframe with right : -80px;. Everything seems to work but the cropping of the right side.

<html lang="en">
<body>

<style>
 #div-id{
    border   : 2px solid blue;
    width    : 600px;
    height   : 800px;
    position : relative;
    overflow : hidden;
}
 #iframe-id{
    position : absolute;
    top      : -160px;
    right    : -80px;
    left     : -25px;
    width    : 620px;
    height   : 450vh;
}
</style>
<div id="div-id">
 <iframe title="example" src="https://example.org" id="iframe-id" scrolling="yes"></iframe>
</div>

</body>
</html>

I've tried to:

  • change the right and left to margin-right and margin-left
  • "Full"-refreshed the browser via ctrl+F5
  • Changed the value from -80px to many different things to see if it is working at all
  • Used Edge and Firefox for testing

答案1

得分: 0

只拿走权利,因为你想向左走。

<style>
  * {
    margin:0;
    padding:0;
  }

  body,html {
    overflow:hidden;
  }
 #div-id{
    border: 2px solid rgb(255, 0, 0);
    width: 40%;
    height: 85%;
    position: relative;
    overflow: hidden;
}

 #iframe-id{
    position: absolute;
    top: -160px;
    left: -80px;
    width: 620px;
    height: 450vh;
}
</style>
<div id="div-id">
 <iframe title="example" src="https://example.org" id="iframe-id" scrolling="yes"></iframe>
</div>

</body>
</html>
英文:

Just take away the right because you want to go left.
<html lang="en">
<body>

&lt;style&gt;
  * {
    margin:0;
    padding:0;
  }

  body,html {
    overflow:hidden;
  }
 #div-id{
    border: 2px solid rgb(255, 0, 0);
    width: 40%;
    height: 85%;
    position: relative;
    overflow: hidden;
}

 #iframe-id{
    position: absolute;
    top: -160px;
    left: -80px;
    width: 620px;
    height: 450vh;
}
&lt;/style&gt;
&lt;div id=&quot;div-id&quot;&gt;
 &lt;iframe title=&quot;example&quot; src=&quot;https://example.org&quot; id=&quot;iframe-id&quot; scrolling=&quot;yes&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;

huangapple
  • 本文由 发表于 2023年7月13日 22:05:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/76680292.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定