tags:

views:

57

answers:

3

I don't know much css or html, so I have a question about taking html that looks like this: html code paste and putting into another page.

The problem is when I just copy and paste this into a webpage is completely messes up the background (turns it black) and overwrites other settings. How can I take that exported html and css so that I can paste the code I exported from emacs into a webpage and not kill other settings? Ideally it would appear just as it currently looks but in a little box inside the rest of the page.

Thanks.

+4  A: 

You can use an IFrame

RandomNoob
any way to do that without the scroll bars?
Chris H
yes you can set the height and width of your iFrame as attributes on the tag
RandomNoob
add this to the stylesheet section html { overflow: hidden }
Dustin Laine
@durilai That's a horrible idea unless you want to end up hiding content from users.
D_N
@DN, it gets rid of scroll bars doesn't it? Never said anything about not hiding content.
Dustin Laine
@durilai Right, it's just that the consequence is big. A consequence is part of a solution, and has to be taken into account.
D_N
I'd like the iframe to not have scroll bars, and take up as much space as needed to display the content. I don't want to set the width/height in pixels since different browsers can display that fonts in different sizes.
Chris H
A: 

You could also paste the code someplace like http://gist.github.com/ or http://pastie.org/ where they also give you some code to embed the code snippet in your site/weblog/etc.

You can see an example of the embedded code (for gist.github.com) here: http://github.com/blog/605-new-languages-highlighted

Bill Turner
+1  A: 
  1. Put the desired HTML/CSS/etc in another file. Call this file2.html
  2. In your main file, use an OBJECT element to embed this document.

    <object data="file2.html" type="text/html">
        <a href="file2.html">View file2</a>
    </object>
    

This will create a "box" with your file inside. You can style the OBJECT element in any way you wish. Removing scrollbars, adjusting the width, etc.
If a browser does not support the OBJECT element, then they will see the link directly to the file.

Nick Presta