Beginner
Beginner

Reputation: 117

iframe position in center

So I found this code for position content in the center, but my problem is that it's made for a container, do you know how to make this for iframe? Or do You know another code for that Code:

.center {
  margin: auto;
  width: 60%;
  border: 3px solid #73AD21;
  padding: 10px;
}
<div class="center"></div>

And this is code I need to place in.

<iframe src="http://80.213.62.138:12/playbutton.html"></iframe> 

Upvotes: 3

Views: 14827

Answers (2)

Bhuwan
Bhuwan

Reputation: 16855

If you want to use your code then apply display:block to the iframe because most of the browsers read iframe as an inline element.

iframe {
  margin: auto;
  width: 60%;
  border: 3px solid #73AD21;
  padding: 10px;
  display: block;
}
<iframe src="http://80.213.62.138:12/playbutton.html"></iframe>

Upvotes: 4

Abdullah .F
Abdullah .F

Reputation: 57

you can add the align to the iframe tag

 <iframe align="center" src="http://80.213.62.138:12/playbutton.html"></iframe> 

Upvotes: 0

Related Questions