# Iframe not centered

**URL:** <https://discourse.nodered.org/t/iframe-not-centered/31518>\
**Category:** Dashboard\
**Created:** [13 August 2020 08:45 UTC](https://discourse.nodered.org/t/iframe-not-centered/31518 "2020-08-13T08:45:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![menno](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@menno](https://discourse.nodered.org/u/menno)\
**Post date:** [13 August 2020 08:45 UTC](https://discourse.nodered.org/t/iframe-not-centered/31518/1 "2020-08-13T08:45:57Z")

</div>

Hi all  
i want my iframe centered in the middle of my tab. see picture

 ![Capture](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/b/4bf60e3a122aba55760f834c3043379d3c889bb7.png)

can you help me out here ??

```auto

[{"id":"38aa91ac.81b13e","type":"function","z":"85c6adaf.bd9f5","name":"buienradar","func":"d = new Date().getTime()\n\no = \"<iframe src='https://gadgets.buienradar.nl/gadget/zoommap/?lat=52.26417&lng=4.63056&overname=2&zoom=6&naam=nieuw-vennep&size=2&voor=1' scrolling=no width=256 height=256 frameborder=no></iframe>\"\n\nreturn {template:o};","outputs":1,"noerr":0,"x":790,"y":1360,"wires":[["356499db.6e1596"]]},{"id":"356499db.6e1596","type":"ui_template","z":"85c6adaf.bd9f5","group":"973002a6.a4d9f","name":"","order":1,"width":6,"height":6,"format":"<center><div ng-bind-html=\"msg.payload\"></div></center>\n\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":1420,"y":1360,"wires":[[]]},{"id":"973002a6.a4d9f","type":"ui_group","z":"","name":"BuienRadar","tab":"70669a12.a74c34","order":10,"disp":true,"width":"6","collapse":false},{"id":"70669a12.a74c34","type":"ui_tab","z":"","name":"info","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

many thanks in advance  
m

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [13 August 2020 09:43 UTC](https://discourse.nodered.org/t/iframe-not-centered/31518/2 "2020-08-13T09:43:43Z")

</div>

Did you try adding a 'style' to the `iframe` statement to set a margin?

---

<div class="post-metadata">

**Author:** ![menno](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@menno](https://discourse.nodered.org/u/menno)\
**Post date:** [13 August 2020 09:47 UTC](https://discourse.nodered.org/t/iframe-not-centered/31518/3 "2020-08-13T09:47:38Z")

</div>

yes but that did fix it .  
i hope someone can help me with this

thx  
m

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [13 August 2020 09:55 UTC](https://discourse.nodered.org/t/iframe-not-centered/31518/4 "2020-08-13T09:55:39Z")

</div>

Your response is confusing. Did that fix the issue or not. If not, exactly what did you add?

If it did fix it, please mark this solved.

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [13 August 2020 10:13 UTC](https://discourse.nodered.org/t/iframe-not-centered/31518/5 "2020-08-13T10:13:26Z")

</div>

> [@menno](#):
>
> can you help me out here ??

I think surrounding the iframe tag in the function node by `<div align=\"center\">`and `</div>`  
will do the job like it is done here:

```auto
o = "<div align=\"center\"><iframe src='https://gadg...></iframe></div>"

```

---

<div class="post-metadata">

**Author:** ![menno](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@menno](https://discourse.nodered.org/u/menno)\
**Post date:** [13 August 2020 10:17 UTC](https://discourse.nodered.org/t/iframe-not-centered/31518/6 "2020-08-13T10:17:03Z")

</div>

> [@janvda](#):
>
> `<div align=\"center\">`

YESS!!!!! thats fixed it !!! many many thanx  
i forgot ( i think ) the " in front of it  
m

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [12 September 2020 10:17 UTC](https://discourse.nodered.org/t/iframe-not-centered/31518/7 "2020-09-12T10:17:04Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
