sambit.albus sambit.albus - 2 months ago 21
ASP.NET (C#) Question

How to render a full webpage in smaller iframe?

I have a customized content management system. I'm using CKEditor to change the content. I want a live preview of the webpage when I click submit button after edit. I'm using iframe but it shows horizontal and vertical scroll bars because the webpage is bigger in size.

I want to do it in a specific dimension to view a complete page means render the webpage in a smaller size. Even it is a image of webpage I don't have any problem.

Answer

I love css3please:

<style type="text/css">
.box_scale {
              width:300px;
             height:300px;
  -webkit-transform: scale(0.5);  /* Saf3.1+, Chrome */
     -moz-transform: scale(0.5);  /* FF3.5+ */
      -ms-transform: scale(0.5);  /* IE9 */
       -o-transform: scale(0.5);  /* Opera 10.5+ */
          transform: scale(0.5);
             filter: progid:DXImageTransform.Microsoft.Matrix(/* IE6–IE9 */
                     M11=0.9999619230641713, M12=-0.008726535498373935, M21=0.008726535498373935, M22=0.9999619230641713,SizingMethod='auto expand');
}

</style>

<div class="box_scale">
    <iframe width="300" height="300" src="http://example.org"></iframe>
</div>

The only thing besides selecting a scale was to add a width and height to the div. of course, you might want to add some rules for transform origins as well. See also: https://developer.mozilla.org/en/CSS/transform

Comments