Hi everyone.. This is going to sound like a dumb question but I have to ask it because I really don't understand something here.
I understand that HTML is used to arrange and display data, but HTML has to be written on something and thats where I get stuck.

Lets say I want to create five different pages with different contents on each page using HTML. Where do I get these pages from? Is this what is called an HTML canvas? Can I define borders on an HTML page for printing.

Basically, I have a general understanding of HTML as it is but I'm jut not sure where I have to write it in order to display it.

Thank you all.. I hope somebody can help me understand this.

Dani AI

Generated

Brief answer first: an HTML page is just a plain text file you write with any text editor and save (typically with a .html extension). A browser — Chrome, Firefox, Edge, or an embedded browser component — reads that file and renders it as a page. was right to point out the file-on-disk workflow; MDN has a clear introduction to creating and viewing simple HTML pages: HTML basics.

For your report idea there are two practical patterns to consider.

  • Write the report as static HTML files (or templates you fill at runtime) and open them with the default browser via a file path or by launching the file. This is the simplest route for static reports but beware: some features (Ajax, service workers) are restricted when loaded from file:// URLs — use an HTTP server if you need those features (see the note on same-origin policy).
  • Embed a browser engine inside your app so it displays the generated HTML directly. Common options are WebView2 (Windows/Edge) or the Chromium Embedded Framework (CEF) for cross-platform embedding; these let your program point the control at a directory or in-memory HTML and render it inside your application window. See Microsoft WebView2 docs for one example: WebView2.

About canvas vs. printable pages: as mentioned, the HTML5 <canvas> element is for pixel drawing (charts, drawings) and not for flowing, printable text layout. For printable reports use HTML + CSS and control print behavior with CSS print rules and the @page at-rule; note that browser and printer drivers can add margins or scale output, so always test print preview across targets. See MDN on the canvas element and @page CSS: canvas element and @page.

Recommended Answers

All 3 Replies

HTMl is virtual, it is not 'written' on anything per se, you write your code using a text editor, such as notepad, and store it on the hard disc of a server as 'pages' of your website. When the site is requested by a browser, as you have done with Daniweb, the 'pages' of that site are 'interpreted' by the browser and displayed on the computer monitor.
Google "basic html tutorial" for a good start.

the 'pages' of that site are 'interpreted' by the browser

Thanks Tony, thats clearer now. So, does a browser have to be an internet browser such as chrome, IE or Mozilla? The reason I ask is that I want to display a report generated from an application. I want this to be in HTML (it's just an idea, thats all). So can a browser be an application which can be incorporated into a project that can be invoked to interpret the 'Pages' I create (Text File) with the HTML in them? Maybe if there is, the browser of some description can be linked to the 'Pages' via a Directory Path so it can interpret those 'Pages' and display them in the way I've specified using HTML.

The browser you use simply has to be able to interpret HTML markup. If the page is written in HTML markup thn yes any Internet browser can be used. You don't have to be connected to the Internet to read an HTML file. For example, if you create a file on your local hard drive that contains proper HTML markup and save it, you can open it with a browser.

You asked about HTML canvas. The canvas element was introduced with HTML5 and its just an element that can be used to draw onto.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.