放大固定宽度的div

时间:2019-01-07 09:15:21

标签: css angular

我尝试在使用div进行宽度固定 div内启用transform: scale(aScaleRatio)可缩放滚动, em>放大/缩小。

这里是demo,用于实现放大/缩小。但是,即使我尝试将其与position: absolute; top: 0; left:0对齐,内部 div也无法正确显示左上对齐

任何想法都会感激:)

<html>
<body>
<!--The content below is only a placeholder and can be replaced.-->
<div style="width: 1000px; height: 800px; position: absolute; top: 100px">
  <div style="position: absolute; right: 16px; z-index: 2;">
    <!---something else--->
  </div>
  <!--- this is the scrollable outer div --->
  <div
    style="width:3000px; background-color:red; height: 2000px; z-index: 1; overflow: auto;"
  >
    <!--- I am trying to zoom this div in/out --->
    <!--- sadly I cannot align it within the outer div --->
    <div
    style="position: absolute; transform: scale(1.2); background-color: black; width: 500px; height: 400px; top: 0; left: 0;"
    ></div>
  </div>
</div>
</body>
</html>

或者如何在此pen中显示11111

1 个答案:

答案 0 :(得分:1)

我想这就是您想要的:fork

可以通过将for k = 1:size(values,2) % for fancier colors. b(k).CData = k; end 替换为b(1).Cdata = 2;

来实现

摘录自演示:

[b.CData] = deal(2,1,4,3,5);

检查以下link,以详细了解transform-origin: left;