How To Make A Page Within A Page

Table of contents:

How To Make A Page Within A Page
How To Make A Page Within A Page

Video: How To Make A Page Within A Page

Video: How To Make A Page Within A Page
Video: 11: How to Create Sub Pages in HTML | Basics of CSS | Learn HTML and CSS | HTML Tutorial 2024, November
Anonim

Hypertext Markup Language (HTML) provides the ability to split a page into several windows - "frames". Each of the frames can have its own internet source to display. This mechanism can be used to insert pages from other sites into pages from your site.

How to make a page within a page
How to make a page within a page

It is necessary

Text Editor Notepad

Instructions

Step 1

The HTML code of a page is a set of instructions for the browser telling where on the page each of its elements should be displayed and how it should look. These instructions are called "tags" and to create a page that contains one or more others, you need to write the appropriate set of tags. We start with the tags that create a container for all the frames on the page:

These are the opening and closing tags of the container - the tags that form the frames will need to be placed between them. In HTML, tags have "attributes" - they contain additional information about the properties of the page element, the display of which specifies this tag. In the opening tag of the container, you must specify an attribute that contains information about how the browser should divide the page space between its frames:

The "cols" attribute in this code sample indicates that the page should be split vertically into two frames, with the left one taking up 20% of the window width and the right one 80%. If instead of the "cols" attribute you specify the "rows" attribute, then the page will be split horizontally:

Instead of a number, you can write an asterisk (*):

This will mean that the second frame will be given all the remaining space. Frame sizes can be specified not in percentages, but in units of measurement that are most often used in page layout - in "pixels":

Step 2

The HTML tag of the frame itself, which must be placed in the container, is written as follows: The "src" attribute of the "frame" tag contains the address of the web page that the browser should load into this frame. An address written in this way is called "absolute" - it starts with the https:// protocol. But if this is a page of your own site and it lies in the same (or subfolder) folder, then you do not need to specify the absolute address, only the file name and path to the subfolder will be enough. Such an address will be called "relative": - Borders between frames in the page by default can be moved with the mouse. This feature is disabled by the noresize attribute: - There are two attributes that determine the size of the margins between frames - marginheight sets the vertical margin (top and bottom), and the marginwidth - horizontally (right and left): - Using another attribute - "scrolling" - you can tell the browser the rules for the scrollbars of the frame: The "auto" value specifies that the scrollbars should appear as needed, that is, when the content does not fit within the frame. If you set the value to "yes", then this frame will always have scrollbars, and the value "no", on the contrary, prohibits the display of scrollbars - If the pages contained in the container work with any JavaScript scripts that perform operations in adjacent frames, it may be necessary to distinguish frames by name. The attribute containing the name of the frame is called name:

Step 3

These HTML definitions are enough to create a simple page from several pages from other sites. To do this, you will need any text editor, for example, a standard Notepad. In it, create a new document and write these html tags:

Then save this code with an htm or html extension - for example, test.html. Everything is ready, if you open this document with a browser, the result will look like this:

Two-frame page
Two-frame page

Step 4

There is another type of frame - "floating". It can be located inside a regular page, not divided into frames. Such a frame has additional width and height attributes that define its dimensions. The code of this tag may look like this:

Recommended: