Chris H
Chris H

Reputation: 6581

help embedding some html in a webpage

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.

Upvotes: 1

Views: 94

Answers (3)

Nick Presta
Nick Presta

Reputation: 28665

  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.

Upvotes: 1

Bill Turner
Bill Turner

Reputation: 3697

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

Upvotes: 0

Ta01
Ta01

Reputation: 31610

You can use an IFrame

Upvotes: 5

Related Questions