水平居中嵌入Google Doc?

Not*_*son 5 html css iframe

我是 HTML 和 CSS 新手,一直在通过 HTML for dummies 学习。

不管怎样,我想知道如何水平居中嵌入的谷歌文档。

div#iframe-wrapper iframe {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  margin: auto;
  right: 100px;
  height: 100%;
  width: 100%;
}
Run Code Online (Sandbox Code Playgroud)
<body bgcolor="#414141">
  <title>Rules Page</title>
  <div class="center">
    <iframe width='85%' height='100%' src="https://docs.google.com/document/d/1G1xhqhSK2Ge8diyXELZ3cNvFJj-5wK-0_1VMjCfQR_I/pub?embedded=true">    </iframe>
  </div>
</body>
Run Code Online (Sandbox Code Playgroud)

Sid*_*ril 0

这是做到这一点的方法之一

.center iframe {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
}
Run Code Online (Sandbox Code Playgroud)
<html>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body bgcolor="#414141">
<title>Rules Page</title>
    <div class="center">
        <iframe width='85%' height='100%' src="https://docs.google.com/document/d/1G1xhqhSK2Ge8diyXELZ3cNvFJj-5wK-0_1VMjCfQR_I/pub?embedded=true">    </iframe>
    </div>
</body>
Run Code Online (Sandbox Code Playgroud)