Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 47 - 2606_PlugGPT_C7_Flipbook
P. 47

    Syntax:
                     <iframe src=”url” title=”description”></iframe>

                     We use the src attribute to specify the URL of the document that contains the inline frame and the
                     title attribute to describe the content of the iframe.

                     Other attributes of <iframe> tag are:

                       Height: It is used to control the height of the iframe and its values can be specified in pixel or
                       percentage (px or %).
                       Width: It is used to control the width of the iframe and its values can be specified in pixel or

                       percentage (px or %).
                     Example:

                     <!DOCTYPE HTML>
                     <HTML>
                         <HEAD>
                         <TITLE> iframes Example </TITLE>
                         <STYLE>
                         Body {Background-Color:Grey}
                         </STYLE>
                         </HEAD>
                     <BODY>
                     <H1 STYLE = "text-align:center"> Example of double spread containing
                     inline frames </H1>
                     <iframe src = "Frame1.html" Height = "200" Width = "200"> </iframe>
                     <iframe src = "Frame2.html" Height = "200" Width = "200"> </iframe>
                     </BODY>
                     </HTML>

                     To run the provided HTML code successfully, you will need two additional HTML files that the
                     iframe elements will load. These files are specified by the src attributes in the iframe tags.

                       Frame1.html: This is the file that will be loaded into the first iframe.
                       Frame2.html: This is the file that will be loaded into the second iframe.

                                                                                       Images, Links and Forms in HTML5  45

| 42 43 44 45 46 47 48 49 50 51 52 |