ifarameのレスポンシブが上手行きません。paddingの影響で画面を最大にした時に大きく余白があいてしまいます。
縮めた時
埋め込みが切れてしまう
大きくした時
paddingが大きい
html
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" href="iframe.css"> <title>Document</title> </head> <body> <!-- CONTACT --> <div id="contact"> <div id="contact-top"></div> <div class="iframe-wrap"> <iframe src="https://docs.google.com/forms/d/e/1FAIpQLSdQk7zyuDI79SyoTAZK_PwATr6paabHzFTxLmR1XoU6_kzagg/viewform?embedded=true" width="647" height="1040" frameborder="0" marginheight="0" marginwidth="0" scrolling="no">読み込んでいます...</iframe> </div> </div> <!-- FOOTER --> <footer> <p>©2019 - saranshodo.</p> </footer> </body> </html>
css
@charset "utf-8"; /* FONT デフォルトで"Noto Sans Japanese" */ @import url(http://fonts.googleapis.com/earlyaccess/notosansjapanese.css); /* html5doctor.com Reset Stylesheet v1.6.1 Last Updated: 2010-09-17 Author: Richard Clark - http://richclarkdesign.com Twitter: @rich_clark */ /*要素のフォントサイズやマージン・パディングをリセットしています*/ html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary, time, mark, audio, video { margin:0; padding:0; border:0; outline:0; font-size:100%; vertical-align:baseline; background:transparent; color: #383948; } /*行の高さをフォントサイズと同じにしています*/ body { line-height:1; font-family: "Noto Sans Japanese", sans-serif; } /*新規追加要素のデフォルトはすべてインライン要素になっているので、section要素などをブロック要素へ変更しています*/ article,aside,details,figcaption,figure, footer,header,hgroup,menu,nav,section { display:block; } /*nav要素内ulのマーカー(行頭記号)を表示しないようにしています*/ /*nav ul { list-style:none; }*/ ol, ul { list-style: none; } /*a要素のフォントサイズなどをリセットしフォントの縦方向の揃え位置を親要素のベースラインに揃えるようにしています*/ a { margin:0; padding:0; font-size:100%; vertical-align:baseline; background:transparent; text-decoration: none; } /* mark要素のデフォルトをセットし、色やフォントスタイルを変える場合はここで変更できるようにしています また、mark要素とは、文書内の検索結果で該当するフレーズをハイライトして、目立たせる際に使用するようです。*/ mark { background-color:#ff9; color:#000; font-style:italic; font-weight:bold; } /*テキストに打ち消し線が付くようにしています*/ del { text-decoration: line-through; } /*IEではデフォルトで点線を下線表示する設定ではないので、下線がつくようにしています また、マウスオーバー時にヘルプカーソルの表示が出るようにしています*/ abbr[title], dfn[title] { border-bottom:1px dotted; cursor:help; } /*縦方向の揃え位置を中央揃えに指定しています*/ input, select { vertical-align:middle; } /*画像を縦に並べた時に余白が出ないように*/ img { vertical-align: top; font-size: 0; line-height: 0; } /*box-sizingを全ブラウザに対応*/ *, *:before, *:after { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -o-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; } /* CONTACT */ #contact { width: 100%; /* height: 1147px; */ height: auto; padding-bottom: 110px; } #contact-top { width: 100%; height: 348px; /* height: auto; padding-top: 27.18%; */ background: url('img/contact_back.jpg'); background-repeat: no-repeat; background-size: cover; } #contact .iframe-wrap { position: relative; width: 95%; height: 0; padding-top: 100.74%; margin: -235px auto 0; } #contact .iframe-wrap iframe { display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; } /* FOOTER */ footer { width: 100%; height: 100px; background-color: #494040; text-align: center; } footer p { font-size: 16px; line-height: 100px; font-weight: normal; color: #ffffff; letter-spacing: 0.2em; }
まだ回答がついていません
会員登録して回答してみよう