前提・実現したいこと
【メインコンテンツの完成】
練習のためコーポレートサイトの模写をしています。
PC画面での「画像横並び」が上手くいきません。
画像サイズを50%に指定しましたが、それもうまくいきませんでした。
画像サイズを50%にして{display: flex;}で横並びにできると思いましたが変化はありませんでした。
他にも、下記のコードを試しました。
.case-flexbox { display: flex; } @media screen and (max-width: 960px) { .case-flexbox { width: 100%; text-align: center; margin-bottom: 50px; } } .case-img { width: 50%; text-align: center; }
ご教授の程、宜しくお願い致します。
■見本と模写サイトのリンク
・見本サイト ※模写サイトを提供してるサイト主様がこちらポートフォリオに使ってOKと許可を出しております。
・模写サイト
■使用言語
・HTML
・CSS
■レンタルサーバー
・さくらインターネット(ライト)
■プログラミング経験
・経験年数:4か月
・学習方法:Progate歴3ヶ月(HTML,CSS)
・コードを見た時に何が書いてあるか理解できますが、
私自身で記述できるレベルには到達していません。
↓
2021年3月4日
独学での模写に挑戦中
※検証は30~60分と制限時間を設け、調べても分からない時はこちらで質問させて頂いております。
検証時間が短いと思われる方もいらっしゃるかと思いますが、
教えて貰うことで前に進め、挫折を避けるために時間設定を設けています。
発生している問題・エラーメッセージ
■エラーページ↓↓
■見本ページ↓↓
該当のソースコード
ソースコード: ■■■HTML■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ <!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <meta name="robots" content="noindex , nofollow"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>corporate-site</title> <link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="reset.css" type="text/css" media="screen"> <link rel="stylesheet" href="style.css" type="text/css" media="screen"> </head> <body> <div class="header-container"> <header class="wrap"> <div class="header-test"> <h1 id="header"><a href="#"><img class="logo" src="img/header_logo.png" alt="logo" width="139px" height="60px"></a></h1> <ul class="sec-navi"> <li class="header-list"><a href="#">企業理念</a></li> <li class="header-list"><a href="#">施工事例</a> <li class="header-list"><a href="#">採用情報</a> <li class="header-list"><a href="#">お問い合わせ</a> </ul> <div class="header-icon"> <img src="img/hamburger.svg" alt="ハンバーガーメニュー"> </div> <p class="mainvisual-text">街を作る。未来を作る。</p> </div> </header> </div> <section id="sec-about"> <h2 class="about">お知らせ</h2> <a href="#"> <div class="about1">2020.11.17</div> <div class="about2">お知らせ</div> <div class="about3">本社打合せ室が完成しました。</div> </a> <a href="#"> <div class="about1">2020.11.10</div> <div class="about2">お知らせ</div> <div class="about3">【メディア掲載】住宅雑誌2020年11月号</div> </a> <a href="#"> <div class="about1">2020.11.01</div> <div class="about2">お知らせ</div> <div class="about3">ホームページが完成しました。</div> </a> </section> <section id="sec-case"> <h2 class="case-title">施工事例</h2> <div class="case-flexbox"> <img class="case-img" src="img/building1.png" alt="事例1"> <h3 class="case1">M様邸新築工事</h3> <p class="case2">埼玉県</p> <img class="case3" src="img/more.png" alt="詳細を見る"> <img class="case-img" src="img/building2.png" alt="事例1"> <h3 class="case1">スカイビル</h3> <p class="case2">東京都</p> <img class="case3" src="img/more.png" alt="詳細を見る"> </div> <p class="case4"><a href"#">施工実績一覧</a></p> </section> <section id="sec-img"> <a href="#"><img class="img1" src="img/company.png" alt="img1"></a> <a href="#"><img class="img2" src="img/recruit.png" alt="img2"></a> <a href="#"><img class="img3" src="img/contact.png" alt="img3"></a> </section> <footer id="footer"> <ul class="footer-list"> <li class="footer-list1">企業理念</li> <li class="footer-list1">施工事例</li> <li class="footer-list1">採用情報</li> <li class="footer-list1">お問い合わせ</li> </ul> <a href="#"><img class="footer-logo" src="img/footer_logo.png" alt="footer-logo"></a> <p>Copyright © 2021 Aono Corporation.</p> </footer> </body> </html> ■■■CSS■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ @charset "UTF-8"; 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; vertical-align:baseline; background:transparent; } html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, button, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { border: 0; font: inherit; font-size: 100%; margin: 0; padding: 0; vertical-align: baseline; } header { background-image: url(img/main.png); background-repeat: no-repeat; background-position: center; height: 75vh; background-size: cover; position: relative; object-fit: cover; } @media screen and (max-width: 960px) { .logo { height: 40px; width: 92.66px; } } @media screen and (max-width: 960px) { .wrap { height: 50vh; } } .header-test { max-width: 1100px; margin: 0 auto; } .sec-navi { margin-right: 0px; } a { color: gray; } a:hover { opacity: 0.5; } .header-list { display: inline-block; list-style: none; vertical-align: middle; float: right; margin-right: 55px; margin-top: 55px; justify-content: space-between; } .header-list a { text-decoration: none; } .logo { float: left; margin-top: 30px; } @media screen and (max-width: 960px){ .header-main__text { font-size: 24px; } } .mainvisual-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%); width: 100%; text-align: center; font-size: 48px; } @media screen and (max-width=960px) { .sec-case { padding: 50px 20px } } .case-img { width: 100%; } @media screen and (max-width=960px){ .case-title { font-size: 24px; margin-bottom: 0px; } } #sec-about { padding-left: 40px; padding-right: 40px; } #sec-about a { text-decoration: none; } .about { text-align: center; margin-top: 45px; font-size; 24px; } .about1 { display: block; font-size: 14px; float: left; margin-bottom: 15px; margin-top: 20px; } .about2 { font-size: 11px; border: 1px solid #000; display: inline-block; padding: 3px 6px; margin: 0 30px; margin-bottom: 15px; margin-top: 20px; } .about3 { font-size: 18px; text-decoration: none; margin-bottom: 15px; border-bottom: 1px solid #000; padding-bottom: 20px; } #sec-case { text-align: center; margin-top: 50px; } .case { } .sec-case { padding: 90px 0; max-width: 1100px; margin: 0 auto; } .case1 { font-size: 24px; margin-top: 20px; } .case2 { margin-top: 15px; } img.case-img { margin-top: 20px } img.case3 { width: 50%; height: 50%; margin-top: 20px; } .case-flexbox { display: flex; } .case-img { width: 50%; text-align: center; } @media screen and (max-width: 960px) { .case-flexbox { width: 100%; text-align: center; margin-bottom: 50px; } } .case4 a { text-decoration: none; border: 1px solid #000; display: inline-block; padding: 12px 40px; color: #000; font-size: 20px; margin-top: 20px; } #sec-img { margin-top: 20px; } #sec-img img { width: 100%; display: flex; } .img1 { display: block; } #footer { text-align: center; background-color: #000000; display: block; } .footer-list { list-style: none; color: #ffffff; max-width: 1100px; margin: 0 auto; padding-top: 50px; margin-bottom: 30px; flex-direction: column-reverse; } .footer-list1 { margin-top: 20px; } .footer-logo { height: 40px; margin-bottom: 20px; } #footer p { color: #ffffff; padding-bottom: 20px; } ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
試したこと
一番初めの「実現したいこと」で記載しました。
補足情報(FW/ツールのバージョンなど)
■使用ツール
・Terapad
回答1件
あなたの回答
tips
プレビュー