What are the differences between Div and IFrame?

Goliathstwin

New member
Joined
Mar 21, 2015
Messages
27
Points
0
My HTML skills are being improved day by day by I am learning it recent weeks, just a thing making me stuck is distinguish the differences between Div and IFrame when using it in html file? when should I use Div and IFrame? Can any one explain me?
 

EnricTellez

New member
Joined
Dec 19, 2016
Messages
27
Points
0
a div is just a block which you can fill with stuff like p tags or images.
an iframe is something thats loaded on a different server but displays on your page.

like for example you want to show a google maps thing on your page, you use an iframe so you get the information from googles server.
iframes are really cool, you will likelly use them a lot. :)
 
Last edited:

Mike001

New member
Joined
Apr 27, 2016
Messages
578
Points
0
Let me give you a developers explanation of the difference between a DIV and an iFrame.

When we place a DIV (division) in an HTML document it is meant to be used as a container for HTML elements. A DIV resides in the same window as the body element. It is normally used to separate content for placement and styling. It is not unusual to have div elements nested inside other div elements to allow for very specific styling and browser window placement. Div elements are block level elements in HTML.

An iFrame is meant to load information into your browser window from another sites pages. For instance incorporating a Google Map into the browser window of your site would normally be placed in an iFrame. An iFrame will act as a child element to the main page it resides on. iFrames are inline elements in HTML.

I hope this helps explain the difference between the two elements.
 

dominictuan

New member
Joined
Feb 3, 2021
Messages
2
Points
1
A div and an iframe no matter what the position type of the div is not equivalent. An iframe has an src attribute that lets it load external or other internal HTML pages within your current page. You cannot do this with a div by itself.

There are ways around this, however, it sounds like your just showing a modal popup. In which case you should use a div. Unless you have a need to load external HTML an iframe is not the answer.
 

pngtojpg

New member
Joined
Aug 22, 2022
Messages
3
Points
1
with iframe you can embed websites or html pages
with div you can use only codes
 
Older threads
Replies
4
Views
10,255
Replies
9
Views
6,309
Replies
27
Views
12,125
Replies
14
Views
6,776
Newer threads
Replies
8
Views
4,858
Replies
1
Views
3,296
Replies
12
Views
5,624
Replies
7
Views
4,146
Latest threads
Replies
2
Views
234
Replies
1
Views
690
Replies
1
Views
183
Recommended threads
Replies
1
Views
3,149
Replies
29
Views
10,932
Replies
19
Views
5,040

Referral contests

Referral link for :

Sponsors

Popular tags

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top