Current status of the Ning Platform is always available on the Ning Status Blog.

FORUM

NC for Hire

I've seen many discussions on how to style iframes, so here is a simple guide to get you started.

If you still haven’t heard, hear it now: FRAMES ARE DEAD – well, technically, they are more like the undead – the zombies of webdesign. They should be gone and forgotten but refuse to stay buried. It’s much better not to use them.

However, there may be a situation, where inserting a separate html document into your page makes sense. And there’s an app for that: Iframes (aka inline frames). This code inserts a basic page into an html page:

<iframe src="http://www.siteyouareiframing.com/">
<p>Your browser does not support iframes.</p>
</iframe>

At this point, there is absolutely no styling applied to the iframe, and it looks like this. Note the line regarding lack of browser support. Iframes are supported by all the major browsers, but it’s a good idea to add this for the odd browser that doesn’t.

While I am a strong supporter of using the HTML strict doctype and writing validating, standard-compliant code – iframes will not validate, which leaves us with two options: Either suck up the iframe-related validation errors or switch to HTML transitional doctype for the pages with iframes.

CSS gives you the power to dress your iframe up a bit. The following attributes are available:

  • src (the URL of your iframe)
  • longdesc (this specifies the URL of the iframe, but is hardly supported and can just as well be ignored)
  • name (obviously, the name of your iframe)
  • height (the height of your iframe)
  • width (the width of your iframe)
  • frameborder (1 or 0 – 1 is for yes, 0 for no)
  • marginheight (determines the top and bottom margin of your iframe)
  • marginwidth (determines right and left margins of your iframe
  • scrolling (Do you want a scrollbar? Yes, no, or auto – ‘Yes’, is obvious. ‘No’ should not be used – what if someone does not see the entire content? If this is set to ‘no’, that viewer can never get to the hidden parts of what you’re inserting. ‘Auto’ lets the browser decide if one is needed and seems the best option here to me.)
  • (align) – I’m just mentioning this for completeness; it has been deprecated. Don’t use it.

So this inline CSS:

<iframe src="http://www.siteyoureiframingin.com"
name="siteyoureiframingin.com" height="400px" width="700px"
frameborder="0" marginheight="20" marginwidth="35"
scrolling="auto">
<p>Your browser does not support iframes.</p>
</iframe>

Gives you that. And if you add a bit more CSS to the frame itself:

iframe {
margin-left: 95px;
}

you can position the entire frame where you want it.




You need to be a member of Ning Creators Social Network to add comments!

Join Ning Creators Social Network

Email me when people reply –

Replies

This reply was deleted.

Announcements

 

Some interesting articles related to community management, digital marketing etc. could be found in our digest. Don't hesitate to leave a feedback so we would know that we should continue :-)

Latest Activity

J.Ayvar replied to ⚡JFarrow⌁'s discussion
Yet Another Time Saver: Code for Finding Members Anywhere in US
"Thanks for share! By the way, It Is possible make something similar with the gender option or both…"
10 hours ago
Catherine Grenfell updated their profile
10 hours ago
Rhonda updated their profile photo
11 hours ago
Rhonda replied to ⚡JFarrow⌁'s discussion
Yet Another Time Saver: Code for Finding Members Anywhere in US
"Hi JFarrow,I would like to obtain this code that you have created for finding members via location.…"
11 hours ago
Stan is now a member of Ning Creators Social Network
18 hours ago
Tyler Durbin replied to ⚡JFarrow⌁'s discussion
Yet Another Time Saver: Code for Finding Members Anywhere in US
"Whoa!  Awesome!!"
yesterday
⚡JFarrow⌁ replied to Bernard Lama's discussion
Tip: (Ning 2.0 and 3.0) How to add multiple custom navigation menus in Ning?
"I was thinking about this just the other day... wondering if there might be a way to collapse the s…"
yesterday
Sir Gissachance replied to marie b's discussion
Landing page : won't save ... fragile, slow and buggy
"Hi marie b,
I had the same problem and the only way mine worked was to open the landing page from t…"
yesterday
9jabook Abi John replied to Anastasia_Ning_Support's discussion
Why should I migrate?
"ning 3.0 is probably the biggest mistake ning has made imo . i ahve been on ning 2.0 for 10yrs ! a…"
yesterday
Anastasia_Ning_Support replied to Ana Massien's discussion
Leaderboards and Points
"Hi there!
This feature was launched as a way of encouraging members to be active and generate conte…"
yesterday
Anastasia_Ning_Support replied to Ana Massien's discussion
Emoji, @mentions and tags?
"Hello Ana!
These updates have been requested for a long time now, but unfortunately, they will not…"
yesterday
Anastasia_Ning_Support replied to Anastasia_Ning_Support's discussion
Step-by-step migration guide
"Hello Fred!

You can check the list via the link - https://www.ning.com/ning3help/content-that-cann&hellip;"
yesterday
More…

Meanwhile, you can check our social media channels