Horizontally integrated google doc?

I am new to html and css and am learning HTML for dummies.

Anyway, I was wondering how I would do the horizontal centering of an embedded google doc.

<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>

div#iframe-wrapper iframe {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    margin: auto;
    right: 100px;
    height: 100%;
    width: 100%;
}

      

+3


source to share


1 answer


This is one way to do it



.center iframe {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
}
      

<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 codeHide result


0


source







All Articles