Add Formatting to iframe Using HTML & CSS

  • Thread starter mtanti
  • Start date
  • Tags
    Css Html
In summary, iframes are a useful tool for updating sections of a website with plain text files, allowing for formatting such as color, font, and background. This can be achieved by mimicking an iframe using server-side scripting and including a stylesheet, or by dynamically pulling text from XML or a database. However, if you specifically want to use iframes with CSS, there are resources available from the W3C and Microsoft for guidance.
  • #1
mtanti
172
0
I once read on a tutorial that iframes are useful when you have non technical people writing text files to update a section of your web site, such as a secratery writing the news section.

There are useful because you just upload a plain text text file to a location and the iframe will have it displayed with formatting. Such as colour, font, background, etc.

How do you apply formatting to an iframe that way?

THANKS!
 
Technology news on Phys.org
  • #2
  • #3
Yeah if you have PHP you could use "include" to include a stylesheet to the file you're updating. The file can be a plain PHP page with only text and the include command at the top.
 
  • #4
The standard way is to pull the text dynamically from XML or a database and write it to the page via a server-side script, like ASP or PHP. The advantage of this is that you can then, for example, make a form that allows you to "post" new, or edit old, content.

But if you want to use IFrames with CSS, then:
http://www.w3.org/TR/html4/present/frames.html#h-16.5
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/frameset.asp
 
Last edited by a moderator:

Related to Add Formatting to iframe Using HTML & CSS

1. How do I add formatting to an iframe using HTML and CSS?

To add formatting to an iframe using HTML and CSS, you can use the "style" attribute or an external CSS file. In the "style" attribute, you can use CSS properties such as "border", "width", and "height" to format the iframe. You can also use CSS selectors to target the iframe and apply specific formatting rules.

2. Can I add a border to my iframe using CSS?

Yes, you can add a border to your iframe using CSS. To do so, you can use the "border" property and specify the border width, style, and color. For example, "border: 1px solid black;" will add a 1px black border to your iframe.

3. Is it possible to change the size of an iframe using CSS?

Yes, you can change the size of an iframe using CSS. You can use the "width" and "height" properties to specify the desired size. You can also use percentage values for a responsive design.

4. How can I center my iframe on the page using CSS?

To center an iframe on the page using CSS, you can use the "margin" property and set it to "auto". This will automatically center the iframe horizontally on the page. You can also use the "text-align" property and set it to "center" to center the iframe within its parent element.

5. Can I add a background color to my iframe using CSS?

Yes, you can add a background color to your iframe using CSS. You can use the "background-color" property and specify the desired color. This can be useful if your iframe has transparent areas or if you want to add a visual element to your iframe.

Similar threads

  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
7
Views
1K
  • Programming and Computer Science
Replies
4
Views
1K
  • Computing and Technology
Replies
8
Views
2K
  • Programming and Computer Science
Replies
32
Views
2K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
11
Views
3K
  • Programming and Computer Science
Replies
1
Views
2K
  • Computing and Technology
Replies
3
Views
2K
  • Programming and Computer Science
Replies
4
Views
2K
Back
Top