Lably
Skip to content

Frame (World Wide Web)

Conflation of multiple HTML elements for web-page display

  • 7 min read
  • 6 chapters

Related on Lably

Through Web browser, Web page and Window (computing)

In HTML, a frameset is a group of named frames to which web pages and media can be directed; an iframe provides for a frame to be placed inside the body of a document.

Since the early 2000s, concern for usability and accessibility has motivated diminished use of framesets and the HTML5 standard does not support them.

Tags and attributes

The frames in HTML are created using the <frameset></frameset> tag pair. The <frameset> tag is a container tag for all other tags that are used to create frames. The <frameset> tag replaces the <body> tag in frameset documents.The <frameset> tag defines how to divide the window into frames.

Each frameset defines a set of rows or columns. If user define frames by using the rows attribute then horizontal frames are created. If user define frames by using cols then vertical frames are created.

The <noframes> element may be included so web browsers with frames disabled (or browsers that do not support frames) can display something to the user, as in this example:

<span id="mwKw"></span><span class="p" id="mwLA"><</span><span class="nt" id="mwLQ">frameset</span> <span class="na" id="mwLg">cols</span><span class="o" id="mwLw">=</span><span class="s" id="mwMA">"85%, 15%"</span><span class="p" id="mwMQ">></span> <span class="p" id="mwMg"><</span><span class="nt" id="mwMw">frame</span> <span class="na" id="mwNA">src</span><span class="o" id="mwNQ">=</span><span class="s" id="mwNg">"http://www.example.com/frame_1.html"</span> <span class="na" id="mwNw">name</span><span class="o" id="mwOA">=</span><span class="s" id="mwOQ">"frame_1"</span><span class="p" id="mwOg">></span> <span class="p" id="mwOw"><</span><span class="nt" id="mwPA">frame</span> <span class="na" id="mwPQ">src</span><span class="o" id="mwPg">=</span><span class="s" id="mwPw">"http://alt.example.com/frame_2.html"</span> <span class="na" id="mwQA">name</span><span class="o" id="mwQQ">=</span><span class="s" id="mwQg">"frame_2"</span><span class="p" id="mwQw">></span> <span class="p" id="mwRA"><</span><span class="nt" id="mwRQ">noframes</span><span class="p" id="mwRg">></span> Your browser does not support frames. <span class="p" id="mwRw"><</span><span class="nt" id="mwSA">a</span> <span class="na" id="mwSQ">href</span><span class="o" id="mwSg">=</span><span class="s" id="mwSw">"http://www.example.com/frame_1.html"</span><span class="p" id="mwTA">></span>Click here<span class="p" id="mwTQ"></</span><span class="nt" id="mwTg">a</span><span class="p" id="mwTw">></span> to view frame 1. <span class="p" id="mwUA"><</span><span class="nt" id="mwUQ">a</span> <span class="na" id="mwUg">href</span><span class="o" id="mwUw">=</span><span class="s" id="mwVA">"http://alt.example.com/frame_2.html"</span><span class="p" id="mwVQ">></span>Click here<span class="p" id="mwVg"></</span><span class="nt" id="mwVw">a</span><span class="p" id="mwWA">></span> for frame 2. <span class="p" id="mwWQ"></</span><span class="nt" id="mwWg">noframes</span><span class="p" id="mwWw">></span> <span class="p" id="mwXA"></</span><span class="nt" id="mwXQ">frameset</span><span class="p" id="mwXg">></span>

Framesets have a border attribute. If set to an integer greater than 0, the user can resize the frames by dragging this border, unless a noresize attribute is present in a frame element. If border is set to 0, no border will be displayed and content in different frames will abut each other without delineation.

The iframe element is used inline within a normal HTML body, and defines the initial content and name similarly to the frame element. Any text inside an <iframe></iframe> tag pair will be displayed in browsers that do not understand the iframe tag.

<span id="mwaA"></span><span class="p" id="mwaQ"><</span><span class="nt" id="mwag">iframe</span> <span class="na" id="mwaw">src</span><span class="o" id="mwbA">=</span><span class="s" id="mwbQ">"http://www.example.com/frame_1.html"</span> <span class="na" id="mwbg">height</span><span class="o" id="mwbw">=</span><span class="s" id="mwcA">"480"</span> <span class="na" id="mwcQ">width</span><span class="o" id="mwcg">=</span><span class="s" id="mwcw">"640"</span><span class="p" id="mwdA">></span> Your browser does not support iframes. <span class="p" id="mwdQ"><</span><span class="nt" id="mwdg">a</span> <span class="na" id="mwdw">href</span><span class="o" id="mweA">=</span><span class="s" id="mweQ">"http://www.example.com/frame_1.html"</span><span class="p" id="mweg">></span>Click here<span class="p" id="mwew"></</span><span class="nt" id="mwfA">a</span><span class="p" id="mwfQ">></span> to view the content. <span class="p" id="mwfg"></</span><span class="nt" id="mwfw">iframe</span><span class="p" id="mwgA">></span>

Sign in to keep reading

5 more chapters are free with a Lably account.

More in Computing and communication