JavaScript Center twitter embed iframe center twitter embed,center twitter embed wordpress,centre twitter embed

I'm using the Twitter oembed api, and now have the following code on my page:

<div class='row'>

   <iframe id="twitter-widget-0" scrolling="no" frameborder="0" allowtransparency="true" class="twitter-tweet twitter-tweet-rendered" style="display: block; max-width: 99%; min-width: 220px; padding: 0px; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; margin: 10px 0px; border-color: rgb(238, 238, 238) rgb(221, 221, 221) rgb(187, 187, 187); border-width: 1px; border-style: solid; box-shadow: rgba(0, 0, 0, 0.14902) 0px 1px 3px; position: static; visibility: visible; width: 500px;" title="Embedded Tweet" height="186"></iframe>
   <script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

</div>

http://jsfiddle.net/EzeG2/

Basically all I'm trying to do is center horizontally the iframe in the .row, but only with CSS, because I don't control any of the styles that are inlined with the iframe. margin:0 auto; doesn't seem to work.

Answer:1

I am going to assume that you can't change the inline styles of this iFrame for my answer.

The problem is that your inline styles are overriding your margin: 0 auto; class. A fix for this would be to throw !important onto to your margin: 0 auto; class like so..

.row iframe{
    margin:0 auto !important;
    display:block;
}

jsfiddle

If you can edit the inline styles of the iFrame, then you could remove the margin:10px 0px; or edit that be your desired result of margin: 10px auto;

Answer:2

If I try to extend an entity in Breeze via constructor with something like: breeze.EntityManager('ServiceUrl').metadataStore.registerEntityTypeCtor( 'customer', function () { this.orders = ko....

If I try to extend an entity in Breeze via constructor with something like: breeze.EntityManager('ServiceUrl').metadataStore.registerEntityTypeCtor( 'customer', function () { this.orders = ko....

I am creating an object var testobj=function(x) { var b,c; var a=x; var init=function(d,e,f) { a=d; b=e; c=f; }; return{ init:init, b:...

I am creating an object var testobj=function(x) { var b,c; var a=x; var init=function(d,e,f) { a=d; b=e; c=f; }; return{ init:init, b:...

I have a question about Javascript. I want to set some paragraphs on my page to hidden when the page loads, then have the paragraphs accessed by clicking on the heading. This is the html: <div id="...

I have a question about Javascript. I want to set some paragraphs on my page to hidden when the page loads, then have the paragraphs accessed by clicking on the heading. This is the html: <div id="...

Lazy loading tests: I am trying to build a test for Jasmine to test a method that uses Q.delay. To go around the 10 seconds wait i'm using Jasmine's clock: jasmine.Clock.tick(10010); This works on ...

Lazy loading tests: I am trying to build a test for Jasmine to test a method that uses Q.delay. To go around the 10 seconds wait i'm using Jasmine's clock: jasmine.Clock.tick(10010); This works on ...

  1. jasmine clock tick not working
  2. jasmine clock tick example
  3. jasmine clock tick
  4. jasmine.clock().tick(10)
  5. jasmine.clock.tick is not a function
  6. jasmine clock tick promise
  7. jasmine.clock().tick(101)