ADDING ITEMS BY 'IFRAME'
The 'iframe' is an element identified each with its own name, that enables the following functions:
a) insert an .htm page within the 'iframe'
b) insert an 'iframe' within a DIV
c) dynamically change the page contained in it giving as address with the name of the 'iframe'
For better understanding I give here an example graph using the pattern of the previous FIGURE 1, by inserting an IFRAME in each DIV
we use DIV 'testata' to put an iframe here identified with name = "sopra" which in turn contains a page with logos and whatnot |
|
|
|
|
|
we use the DIV "colonna-sinistra" to put inside it an iframe identified as name = "sinist" which in turn it contains a page with a menu |
|
Inside the DIV 'corpo' we put another DIV
We insert the DIV id = "colonna-destra" to put inside it an iframe identified as 'dest' ie name = "dest" which at first contains a first page.
<DIV id="cornice">
<DIV id="testata"></DIV>
<DIV id="corpo">
<DIV id="colonna-sinistra"></DIV>
<DIV id="colonna-destra"></DIV>
</DIV>
</DIV> |
|
|
|
FIGURE 2 - setting 'iframes' into the page DIVs
Here the style sheet modified with the addition of a right column, flanked to the left column and with complementary width.If you copy these pages remember that you've to adjust links.
<style type="text/css">
body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px;background-image:url(../../images/roma-di-notte.jpg);}
# cornice { padding: 0px; text-align: center; margin: 0 auto; }
#testata { margin: 0px auto; top: 0px; width: 100%; height: 80px; position: relative; background-image: url(../../../images/testaroma.jpg);
}
#colonna-sinistra { width: 200px; height: 598px; position:absolute; background-image:url(../../images/sanpietro1.png ) ; text-align: center; }
#colonna-destra { width: 760px; height: 598px; position:absolute; left: 201px;
background-image:url(../../images/pansoff..png ) ; text-align: center; }
#corpo { margin: 0px auto; border: 0px solid rgb(0, 0, 0); border-image: none; width: 980px; height: 600px; text-align: left; padding-bottom: 0px; position:relative;}
</style>
|
As you can see we have included a right column with a semi-transparent background-image (pansoff.png) which will allow a better sight of the text that we will write.
We provide now to build pages for different frames, left to right. If you want to build a page to fit into the header, remember that here the height of the frame should not exceed 80px.
A) Simple menu into the left column
Let's take an example of the statement to be written between <div id = "colonna-sinistra"> ..... </ div> to add a menu named paginamenu.htm
<div id="colonna-sinistra">
<iframe id= "sinist" src="paginamenu.htm" margin="0" width="350" height="500" frameborder="0" overflow="visible" ></iframe></div>
Initially in each 'iframe' we will have an fixed page. By clicking a link in the left column of the menu you can change the page to the right column by assigning as 'target' (target) the name of the iframe entered the right column. Here is the link of the menu item that brings into the right column iframe a file called 'pagmissione.htm'. The insertion occurs when you click a link from the menu.
<a href="pagmissione.htm" target="dest" accesskey="M">Co<u>M</u>e Funziona</a>
Let's build at first the menu into the left column, and after a few pages to be included on the right column byr clicking links assigned to each item in the menu on the left.
Table: elements to be included into the IFRAMEs
Click the button |
Item |
CSS and HTML code |
1 |
|
paginamenu.htm
page containing menu items to use into an iframe named "sinist" iinto the DIV "colonna-sinistra" |
body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px;}
table {
table-layout: fixed;
width: 200px; border:thin; border-collapse: separate;
border-spacing: 5px;
background:white;
border-radius:10px;
column-width:200;
white-space:normal;
background-size:auto;
}
td {background-color:#06F; color:#FFF; font-family:Cambria; font-weight:bold; width:200px; border-radius:10px; height:35px; alignment-baseline:middle; padding-left:10px; padding-top:3px;} |
2 |
|
pagmissione.htm
page to put into the iframe named "dest" into the DIV "colonna-destra" |
CALL THE PAGE AND SEE YOURSELF HOW IT IS MADE THE HTML CODE.
The style sheet is embedded in the head of the page. You could also separate it in another linked style sheet |
3 |
|
With these statements we put into the page of Figure 2
1) the menu 'paginamenu.htm' by the iframe 'sinist'
2) The page 'pagmissione by ' iframe 'dest' |
<div id="cornice">
<div id="testata"></div>
<div id="corpo">
<div id="colonna-sinistra"><iframe name="sinist" src="../../software/esempi/opere/paginamenu.htm" margin="0" width="100%" height="100%" frameborder="0" overflow-style="visible" scrolling="no" vspace="80"></iframe></div>
<div id="colonna-destra">
<iframe name="dest" src="../../software/esempi/opere/pagmissione.htm" margin="0" width="760" height="100%" frameborder="0" overflow-style="visible" scrolling="no" vspace="80"></iframe>
</div>
</div>
</div> |
TABLE 3:
Elements to be included in the iframes
To insert an iframe in a DIV must write between <DIV> ... </ DIV> a statement like the following:
- assign the name (name) to the frame, in this case name = "dest"
- put in the frame the desired page with the statement
src = "../../ software / examples / works / pagmissione.htm"
where in this case we recall the page pagmissione.htm. See above code in blue.
- assign margin. size, and other congruent characteristics of the frame
<Iframe name = "dest" src = "../../ software / examples / works / pagmissione.htm" margin = "0" width = "760" height = "100%" frameborder = "0" overflow-style = "visible" scrolling = "no" </ iframe>
When by menu you want to put a page inside an iframe just give the page address with the target the name of the target frame.
Here we've used iframe inside a DIV, but there may be DIV inside an iframe, or nested iframes. The language XHTML is very versatile and easy. Just enough understand the mechanisms. |