Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS/HTML5 equivilent to iframe marginheight and marginwidth

I am doing a website layout for a company who uses IDevAdManager for rotating ads on their site. Unfortunately, I am not much of an expert in that field, so I can't give much on that. What I can say for sure though, due to the nature of the generator, the source inside the iframes it generates are not editable by me.

Now, here is my problem.

I am trying to make their new website HTML5 compliant, but I have reached an interesting issue.

When it comes to adding the iframes from the ad rotator, it generates all of the old, depreciated tags used by previous implementations of HTML.

Obviously, most of this is removable with CSS. All except, however, for the marginheight and marginwidth attributes.

Here is where I reach my problem. There does not seem to be a CSS equivalent to either marginheight or margin width, and there is no way to access the source within the iframes. However, leaving them out prevents the inner content from lining up properly.

I am hoping to find a solution that is both valid HTML5, and solves my problem.

Does such an option currently exist? Or will I have to use the deprecated tags until a solution is designed?

like image 542
cbright6062 Avatar asked Feb 15 '12 01:02

cbright6062


1 Answers

Actually this is a valid question. Unfortunately it turns out that the marginheight, marginwidth and frameborder are properties of the iframe element itself, not the element's style property see http://www.w3schools.com/jsref/prop_frame_marginheight.asp

So, for example, you can do this in JavaScript:-

document.getElementById("SomeIframe").marginheight = "0";

but you CANNOT do this

document.getElementById("SomeIframe").style.marginheight = "0";

and setting the margin has NO EFFECT (i.e. you will still get the default margin in the iframe element):-

document.getElementById("SomeIframe").style.margin = "0";

So the answer to cbright6062's question is that there is no way to set the marginheight, marginwidth and frameborder properties of an iframe in a style sheet.

like image 118
tatty Avatar answered Oct 05 '22 23:10

tatty