Center

Asked

Viewed 338 times

1

I would like to know how I do to keep the chat centered.

<iframe src="https://www2.cbox.ws/box/?boxid=2392843&boxtag=uStqza" width="75%" height="450" allowtransparency="yes" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto"></iframe>

3 answers

1

Creates a div, puts the chat inside. In the CSS you do:

#div
  margin: 0 auto;
}

In the Javascript you do:

function centraliza(){
  var div = document.getElemenById('div');
  div.style.marginTop = (window.innerHeight / 2) - (div.offsetHeight / 2) + 'px';
}

centraliza(); "You put this function on the onload page and/or onresize as well"

0

You can add style="margin: 0 auto; display: block;" at the iframe:

<iframe style="margin: 0 auto; display: block;" src="https://www2.cbox.ws/box/?boxid=2392843&boxtag=uStqza" width="75%" height="450" allowtransparency="yes" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto"></iframe>

Example:

<iframe style="margin: 0 auto; display: block;" src="https://www2.cbox.ws/box/?boxid=2392843&boxtag=uStqza" width="75%" height="450" allowtransparency="yes" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto"></iframe>

-1

creates a div or class and there in css you put: example with class: in html:

<div class="chat">
<iframe src="https://www2.cbox.ws/box/?boxid=2392843&boxtag=uStqza" width="75%" height="450" allowtransparency="yes" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto"></iframe>
</div>

in css:

.chat{
 position: absolute;
 left: 50%;
 top: 50%;

}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.